1836770 Members
2316 Online
110109 Solutions
New Discussion

Re: sort help needed

 
Ashwin_4
Frequent Advisor

sort help needed

Hi guys,
Could some ont explain the meaning of following sort command,

# sort -t, +1 -2 +2 -3 +3 -4 +4 -5 file_name

Thanks in advance.
3 REPLIES 3
Rajeev  Shukla
Honored Contributor

Re: sort help needed

Thats a sort command with obsolete options used for field_start and field_end (replaced by -k now).
-t, means delimiter is "," and then +1-2 are the field start and end to limit the sort within the fields
Michael Steele_2
Honored Contributor

Re: sort help needed

Sort the file_name with the field separator ','. and then those pluses and minus are field end options where I believe a comma will appear to the right of the first column for a plus and to the left of the 2nd column, and so on to the fifth column.

Try your command on /etc/passwd substituting a : for ,.

Here's a link that says its obsolete:

http://www.rbi.informatik.uni-frankfurt.de/doc/man/hpux/sort.1.html
Support Fatherhood - Stop Family Law
BPatrick
Trusted Contributor

Re: sort help needed

Hi Ashwin,
In this sort command, -t is specified for field seperator. So comma (,) is the field seperator. +1 is the field start column and -2 is the field end column and same is the case for +2 -3 ,+3 -4 +4 -5.
But this +position is obsolete now. It is replaced by the -k option.
Regards

Patrick