|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Sort By Certain Order
Hi There,
I have a list of info in a txt document. Now I wanna sort it in certain order, how do I do it? Pls help. info.txt ===== Firstname1,Lastname1,University,Address Firstname2,Lastname2,University,Address Now, I would like to sort my information By University! Can anyone tell me the command?? Alianto |
|
#2
|
||||
|
||||
|
The command is sort.
The -k option selects the field to sort on, starting with 1. The -t option specifies the field separator Try: Code:
sort -t, -k3 info.txt |
|
#3
|
|||
|
|||
|
Actually, I only needed the column that I wanted to sort, thus, I have also found the solution with cut.
cut -d, -f3 info.txt | sort > uni.txt Thanks for your help, Your command gives me something that is not so complicated. Btw, why does <man sort> shows the usage of sort, instead it shows all kinda c codes which make me dizzy! Alianto |
|
#4
|
|||
|
|||
|
try "man 1 sort"
__________________
-- Manuel Hirsch - Linux, FreeBSD, programming, administration articles, tutorials and more. |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > Linux Help > Sort By Certain Order |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|