LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-14-2010, 08:49 PM   #1
calexander
LQ Newbie
 
Registered: Apr 2010
Posts: 10

Rep: Reputation: 0
sort text file


What is the command to sort a text file by the second word?
 
Old 05-14-2010, 08:53 PM   #2
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,811
Blog Entries: 1

Rep: Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191
Can you be more specific? Alphabetically according to the second word?
 
Old 05-14-2010, 09:08 PM   #3
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,811
Blog Entries: 1

Rep: Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191
OK, by default 'sort' works on the first column/word. To make it work on the second one:
Quote:
sort +1 file.txt
 
Old 05-14-2010, 09:11 PM   #4
cola
Senior Member
 
Registered: Sep 2007
Location: Dhaka,Bangladesh
Distribution: Debian
Posts: 1,031

Rep: Reputation: 63
Quote:
Originally Posted by calexander View Post
What is the command to sort a text file by the second word?
Please elaborate with example.
 
Old 05-15-2010, 01:57 PM   #5
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
calexander;

I'm seeing a pattern with you that looks like a series of homework questions.

One problem is that you so far have not posted any follow-up in any of the threads you have started. If this continues, people are not going to help you.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to sort text file and split into smaller files michaeljoser Linux - Software 8 10-19-2007 02:50 AM
Is there a line limit with the sort utility? Trying to sort 130 million lines of text gruffy Linux - General 4 08-10-2006 09:40 PM
sorting text file - sort command man_linux Linux - General 16 08-09-2006 05:58 PM
Advanced Linux Sort text file Command soulxcavtor Linux - Software 1 06-07-2006 11:58 PM
Reverse Sort Text File BxBoy Linux - General 1 08-02-2004 11:13 AM


All times are GMT -5. The time now is 10:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration