Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!husc6!hao!oddjob!gargoyle!ihnp4!twitch!homxb!hou2d!avr From: avr@hou2d.UUCP (Adam V. Reed) Newsgroups: comp.unix.questions,comp.sources.wanted Subject: Re: Multiple Field Sorts in UNIX(tm) Message-ID: <1480@hou2d.UUCP> Date: Wed, 22-Jul-87 12:26:47 EDT Article-I.D.: hou2d.1480 Posted: Wed Jul 22 12:26:47 1987 Date-Received: Sat, 25-Jul-87 01:34:27 EDT References: <2459@whuts.UUCP> Organization: AT&T Bell Laboratories, Holmdel Lines: 13 Summary: cut and paste, sort and cut Xref: mnetor comp.unix.questions:3297 comp.sources.wanted:1684 In article <2459@whuts.UUCP>, tes@whuts.UUCP (STERKEL) writes: > I need a multiple field sort that maintains sub-field order. > Using Sort(1) "scrambles" the previous sorts on each pass, > leaving me with no easy way to use sort(1) to do multiple > field sorts. > > Any hints? Yes. Use cut(1) to merge the relevant fields in the proper order into a single field, paste(1) the result in front of the original, sort(1) the result on the merged field, and then cut(1) the merged field away. This is a classic UNIX one-liner pipeline problem. Adam Reed