LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Redhat Data Sort (https://www.linuxquestions.org/questions/linux-software-2/redhat-data-sort-304714/)

eivets 03-22-2005 11:44 AM

Redhat Data Sort
 
All,

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?

Cheers

codeguy 03-22-2005 01:14 PM

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

what have you tried so far?

-Andy

eivets 03-22-2005 03:10 PM

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.

Cheers

homey 03-22-2005 03:52 PM

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


All times are GMT -5. The time now is 07:50 PM.