Solved

Sort file by columns

Posted on 2011-09-08
2
249 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
AWS Central Authentication 1 101
ignore other .htaccess 2 69
block mails from a particular country in postfix 7 47
Advice on ESXi 5.1 Health / Storage 1 41
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

740 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