Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 03-22-2005, 11:44 AM   #1
LQ Newbie
Registered: Mar 2005
Posts: 2

Rep: Reputation: 0
Redhat Data Sort


Im totally new to this operating system and im picking up the commands ok at the moment, however im trying to sort data that is in a text file by a column.

Can anyone help me with the command?

Old 03-22-2005, 01:14 PM   #2
Registered: Jan 2004
Distribution: Slackware
Posts: 187

Rep: Reputation: 45
Did you try 'man sort' ? -k looks like a good option, assuming its a fixed length column.

what have you tried so far?

Old 03-22-2005, 03:10 PM   #3
LQ Newbie
Registered: Mar 2005
Posts: 2

Original Poster
Rep: Reputation: 0
sorry i should have said its actually 3 columns, ad im wanting to sort the data by the third, im sure this is possible just that because i am totally new to this i dont know how to do it.

Old 03-22-2005, 03:52 PM   #4
Senior Member
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 60
Yep, sort -k is where it's at...
For example: cat myfile.txt | sort -k 3
or if you would like to reverse the sort order, try something like this...
cat myfile.txt | sort -k 3 -nr


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
Unix data sort question amytys Programming 2 07-01-2005 06:24 AM
RedHat Enterprise driver for DELL V.9X Data/Fax Modem? DSLC Linux - Hardware 0 06-26-2004 10:06 AM
Recovering deleted Data in Redhat 9 linuxeagle Linux - Networking 0 05-29-2004 01:33 PM
Copying data from redhat 9 to winxp share? Sn7 Linux - Networking 1 05-20-2004 10:38 AM
[RedHat] ext3 data=writeback question WeNdeL Linux - Distributions 0 10-22-2003 07:41 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:54 PM.

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