Quote:
Originally Posted by
Trellot
I have a file with four fields and an awk script that strips out one field displaying the remaining three. I have added headings for each of these fields such as Player - Year - RBIs then below it comes the data. What I am trying to do is sort the RBIs field in my script from most to least at the shell prompt using the sort command ...however, the headings are also getting sorted! How can I disclude (heh, not even a word, but sounds right) the three headings from my sort?
Trellot
For example, I have this:
BEGIN { printf("%8s%12s%9s\n", "Player", "Year", "RBIs")
printf("\n") }
{ printf("%8s%12s%10s\n", $1, $2, $4) }
then i type into the shell: awk -f "script" "file" | sort -k 3nr
but then my headings go to the bottom of the output. Can you sort specific lines within their respective field, thus leaving my headings alone?
hmm....