Issue
I have the below file.rpt:
Data Manhattan Wire Wire
Delay Distance Length Diff[%]
#############################
0.558 728.282 738.89 1%
0.481 255.258 285.887 12%
0.552 652.888 677.985 4%
0.431 420.896 477.73 14%
0.506 580.288 633.018 9%
0.388 350.22 463.05 32%
0.541 622.088 672.761 8%
0.462 384.064 586.98 53%
0.565 574.016 594.434 4%
0.470 339.268 450.927 33%
0.566 664.304 672.092 1%
0.441 436.428 534.146 22%
I’m trying to sort one of the column and keep the 3 lines header without any change.
How can I do it without manipulate to other file?
I tried something similar to the below:
head -3 file.rpt ; sort -nrk4,4 file.rpt | -
Solution
I suppose this doesn’t really count as a csh
answer, but:
sh -c '{ sed 3q file.rpt; sed 1,3d file.rpt | sort -nrk4,4; }'
In csh
, you can do:
( sed 3q file.rpt; sed 1,3d file.rpt | sort -nrk4,4; )
Answered By – William Pursell
This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0