Swap two columns - awk, sed, python, perl

后端 未结 9 1501
孤独总比滥情好
孤独总比滥情好 2020-12-01 01:03

I\'ve got data in a large file (280 columns wide, 7 million lines long!) and I need to swap the first two columns. I think I could do this with some kind of awk for loop, to

9条回答
  •  情歌与酒
    2020-12-01 01:39

    This might work for you (GNU sed):

    sed -i 's/^\([^\t]*\t\)\([^\t]*\t\)/\2\1/' file
    

提交回复
热议问题