sort columns by field

hello,

i have a table contain many columns delimited by blank.

i want to sort this table by the 2 columns and 3 one and i want to keep the first line inchanged?
how can i do using the sort command?

thanks

table like :

field1 field2 field3 field4
x y z b
t h r n
..

sorting by columns 1 2 3 and keeping the first line in first place in file:

head -1 table > workingfile
awk 'NR>1' table | sort -k1.1,1.10 -k2.1,2.10 -k 23.1,3.10 >> workingfile

thanks jim it works well :slight_smile: really when i post a question there only you to answer :wink:

i want to know something else if after this sort i want to suppress all but one occurrence of lines having the same second and third field?

kind regards

head -1 table > workingfile
awk 'NR>1' table | sort -k1.1,1.10 -k2.1,2.10 -k 23.1,3.10  | \
    awk '!arr[$2 $3]++' >> workingfile

remove duplicates on col2 and col 3.

i try it but i get this error
arr[ : event not found

i put a space between ! and arr with no result.