Solved

Sort file by columns

Posted on 2011-09-08
2
245 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
Comment Utility
sort -k1,1 -k4,4 inputfile > outputfile
0
 
LVL 38

Assisted Solution

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

-n for numeric sorting
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Daily system administration tasks often require administrators to connect remote systems. But allowing these remote systems to accept passwords makes these systems vulnerable to the risk of brute-force password guessing attacks. Furthermore there ar…
This is the error message I got (CODE) Error caused by incompatible libmp3lame 3.98-2 with ffmpeg I've googled this error message and found out sometimes it attaches this note "can be treated with downgrade libmp3lame to version 3.97 or 3.98" …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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…

771 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

11 Experts available now in Live!

Get 1:1 Help Now