sort question
Kelvin Fielding
jckfield at ihlpb.ATT.COM
Fri May 5 03:34:55 AEST 1989
In article <199448 at hrc.UUCP>, dan at hrc.UUCP (Dan Troxel) writes:
> How can I use the 'sort' command, to sort by two fields?
> Example:
>
> _4 test _E _1 test _E
> _2 test _E should be _2 test _E
> _3 test _F _4 test _E
> _1 test _E _3 test _F
> ^ ^
> ^ ^
> sorted
> by
> --
sort +0 -0 +2 <filename>
will do the trick.
Explanation:
sort on field 1 +0 and ending on field 1 -0 then
sort on field 1 +2.
_ , _
' ) / //
/-< _ // , __o ____
/ ) </_</__\/ <__/ / < o
More information about the Comp.unix.questions
mailing list