Hello There...
I have a sample input file ..
number:department:amount
125:Market:125.23
126:Hardware store:434.95
127:Video store:7.45
128:Book store:14.32
129:Gasolline:16.10
I will be doing some manipulations on all the records except the header, but the header should always be at the top in the output. I want the file to be sorted (asc order on 1st field) and add 1000 as bonus to the field 3 (e.g. 125.23 + 1000).
I tried below:
awk 'BEGIN{FS=OFS=":"}{if( NR != 1){$3+=1000}print}' file
How can I sort the file? I know I could use sort
but how can I sort all rows except the header and header should appear in sorted output?
I am thinking of doing something like this sort file | awk...
any suggestions?
regards,
juzz4fun