LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   shell scripting (https://www.linuxquestions.org/questions/linux-newbie-8/shell-scripting-343338/)

carthyc 07-15-2005 01:51 AM

shell scripting
 
Hai,

can u help me in sorting a file.

let a file has 5 fields, i have to sort it with respect to the 2nd field. can u tell me the command for this.

thanks in advance.....

sorvad 07-15-2005 02:24 AM

This is the simple way of doing it:
If each field is a single word seperated by white space then then use
sort -k2 <file>
If you have spaces within the fields you need to change the field seperator and use the -t option to indicate what it is.

carthyc 07-15-2005 02:27 AM

thanks, I also found it thru man page


All times are GMT -5. The time now is 05:07 AM.