Solved

Sort file by columns

Posted on 2011-09-08
2
246 Views
Last Modified: 2012-05-12
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
0
Comment
Question by:zhshqzyc
2 Comments
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 125 total points
ID: 36505034
sort -k1,1 -k4,4 inputfile > outputfile
0
 
LVL 38

Assisted Solution

by:wesly_chen
wesly_chen earned 125 total points
ID: 36505229
sort -nk1,1  -nk4,4  inputfile > outputfile

-n for numeric sorting
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Automating a script for user accounts LINUX 14 65
Site-to-Site VPN OpenSWAN in AWS VPC to a Sonicwall 5 66
linux ssh 4 57
Why isn't object file created? 6 39
I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now