Sample Header Ad - 728x90

sort but keep header line at the top

106 votes
16 answers
87969 views
I am getting output from a program that first produces one line that is a bunch of column headers, and then a bunch of lines of data. I want to cut various columns of this output and view it sorted according to various columns. Without the headers, the cutting and sorting is easily accomplished via the -k option to sort along with cut or awk to view a subset of the columns. However, this method of sorting mixes the column headers in with the rest of the lines of output. Is there an easy way to keep the headers at the top?
Asked by jonderry (2109 rep)
Apr 23, 2011, 12:05 AM
Last activity: Jul 7, 2023, 09:26 PM