Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!sun-barr!rutgers!bellcore!faline!thumper!ulysses!mhuxo!mhuxu!att!ihlpb!jckfield From: jckfield@ihlpb.ATT.COM (Kelvin Fielding) Newsgroups: comp.unix.questions Subject: Re: sort question Message-ID: <10416@ihlpb.ATT.COM> Date: 4 May 89 17:34:55 GMT References: <199448@hrc.UUCP> Organization: North American Philips Corp, Naperville, Illinois Lines: 26 In article <199448@hrc.UUCP>, dan@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 will do the trick. Explanation: sort on field 1 +0 and ending on field 1 -0 then sort on field 1 +2. _ , _ ' ) / // /-< _ // , __o ____ / )