sort the column

zhshqzyc
zhshqzyc used Ask the Experts™
on
Hi, I have a text file.
I want to order the values from small to large by column 8, output to a new file.

Tks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
sort -k8n,8 data.file > new_data_file

Author

Commented:
so, if sort by column 9.
sort -k9n,9 data.file > new_data_file

Open in new window

sort by column15
sort -k15n,15 data.file > new_data_file

Open in new window

?
you don't really need the  ",9" or ",15"

basically is -k[column num][sort type]

here column 8 -k8
numeric sort default lowest to highest n
so
sort -k8n data.file > new_data_file

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial