Sort file by columns

Hi,

I have a text file whose delimiter is tab. The file has 4 columns. Now I want to get a new file sorted from the old file. The sort order is column1 then column 4.
The first column contains number 1,2,3,4,5....22 and letter X.

Thanks
zhshqzycAsked:
Who is Participating?
 
woolmilkporcConnect With a Mentor Commented:
sort -k1,1 -k4,4 inputfile > outputfile
0
 
wesly_chenConnect With a Mentor Commented:
sort -nk1,1  -nk4,4  inputfile > outputfile

-n for numeric sorting
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.