sort question

Michael J. Chinni, SMCAR-CCS-E mchinni at pica.army.mil
Fri May 5 00:53:12 AEST 1989


> From: Dan Troxel <dan at hrc.uucp>
> Subject: sort question
> Date: 3 May 89 20:15:01 GMT
> To:       info-unix at sem.brl.mil
>
> 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
>
Try: sort +10 -11 +2 -3 filename

This tells sort to sort first on a field starting in col. 10 and ending just
before col. 11, and secondly a field starting in col. 2 and ending just before
col. 3.

/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
			    Michael J. Chinni
      Chief Scientist, Simulation Techniques and Workplace Automation Team
	US Army Armament Research, Development, and Engineering Center
 User to skeleton sitting at cobweb    () Picatinny Arsenal, New Jersey  
   and dust covered terminal and desk  () ARPA: mchinni at pica.army.mil
    "System been down long?"           () UUCP: ...!uunet!pica.army.mil!mchinni
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/



More information about the Comp.unix.questions mailing list