如何将unix中的第一列移到最后一列? [英] How to move first column to last column in unix?
本文介绍了如何将unix中的第一列移到最后一列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是文本文件中的数据.
This is the data in a text file.
0.354167 male atyp_angina 0.066038 0.1621 t normal 0.648855 no 0 up 0 reversable_defect <50
0.625 male typ_angina 0.792453 0.328767 f left_vent_hyper 0.564885 no 0.677419 down 0 reversable_defect <50
0.645833 male non_anginal 0.433962 0.134703 f left_vent_hyper 0.641221 no 0.483871 flat 0 normal >50_1
0.666667 female asympt 0.481132 0.413242 f left_vent_hyper 0.572519 yes 0.16129 flat 0 reversable_defect >50_1
0.270833 male typ_angina 0.509434 0.269406 f left_vent_hyper 0.816794 no 0.129032 up 0.666667 normal <50
我必须将包含数字数据的第一列移动到每一行的最后一列.
I have to move first column contains numeric data to the last column for every row.
例如:
0.354167 male atyp_angina 0.066038 0.1621 t normal 0.648855 no 0 up 0 reversable_defect <50
要
male atyp_angina 0.066038 0.1621 t normal 0.648855 no 0 up 0 reversable_defect <50 0.354167
如何使用bash命令?
How can I do using bash commands?
推荐答案
Perl便于文本操作:
Perl is handy for text manipulation:
perl -lane 'push @F, shift @F; print "@F"' file
这篇关于如何将unix中的第一列移到最后一列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文