Is there a way to ignore header lines in a UNIX sort?

后端 未结 12 2202
余生分开走
余生分开走 2020-11-28 21:02

I have a fixed-width-field file which I\'m trying to sort using the UNIX (Cygwin, in my case) sort utility.

The problem is there is a two-line header at the top of t

12条回答
  •  执念已碎
    2020-11-28 21:40

    This is the same as Ian Sherbin answer but my implementation is :-

    cut -d'|' -f3,4,7 $arg1 | uniq > filetmp.tc
    head -1 filetmp.tc > file.tc;
    tail -n+2 filetmp.tc | sort -t"|" -k2,2 >> file.tc;
    

提交回复
热议问题