例如,我需要删除第25列,并将其替换为第22列的副本,但不包含嵌入的分隔符。我能想出的最好的是尴尬的看着: 在分隔文件中将一列复制到另一列
awk -F, '{ for(x=1;x<25;x++){printf("%s,", $x)};printf("%s,",$22);for(x=26;x<59;x++){printf
("%s,", $x)};print $59}'
I would expect something like
cut -d, -f1-24,23,26-59
to work but cut doesn't seem to want to print the same column two times...
Is there a more elegant way to do it using anything typicaly available in a linux shell environment?
这是一种可悲的是切不支持,那肯定是一个非常有用的功能。 – 2010-04-20 16:19:23
'cut'不重新排列列,或者:'echo -e“a \ tb \ tc”| cut -f 3,2,1'结果为“a [tab] b [tab] c” – 2010-04-20 17:07:56