Off topic: Sort in Unix

C M Reinehr cmrNO
Mon May 17 11:47:10 PDT 2004


Joel,

By specifying the '-n' option to sort, you cause it to sort in numerical 
order, rather than by the local collating sequence. The '-t' option sets 
the field seperater to ';' rather than the default white space.

cmr

Joel Hammer wrote:

> This seems to work, although I am not sure why.
> 
> sort -n -t";" file
> 
> Joel
> 
> On Wed, May 07, 2003 at 04:46:35AM +0100, SaM Raj wrote:
>> Greetings,
>> 
>> The contents of file 1 is as follows
>> 
>> 2;22;22;
>> 44;33;22;
>> 3;13;33;
>> 3;3;33;
>> 22;22;22;
>> I want to sort the file in ascending order by Field 1;
>> Field 2
>> The final file should be something like this:
>> 2;22;22;
>> 3;3;33;
>> 3;13;33;
>> 22;22;22;
>> 44;33;22;
>> Pls let me know the syntax for achieving the same
>> 
>> Thanks,
>> -Jay
>> 
>> ________________________________________________________________________
>> Missed your favourite TV serial last night? Try the new, Yahoo! TV.
>>        visit http://in.tv.yahoo.com
>> 
>> ------------------------ Yahoo! Groups Sponsor ---------------------~-->
>> Make Money Online Auctions! Make $500.00 or We Will Give You Thirty 
Dollars for Trying!
>> http://us.click.yahoo.com/KXUxcA/fNtFAA/uetFAA/dkFolB/TM
>> ---------------------------------------------------------------------~->
>> 
>>  
>> 
>> Your use of Yahoo! Groups is subject to 
http://docs.yahoo.com/info/terms/ 
>> 
>>

-- 
Registered Linux User #241964
----
"Do not meddle in the affairs of Wizards, for they are subtle
and quick to anger." -- Samwise Gamgee


More information about the Linux-users mailing list