Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!gatech!hao!ames!oliveb!sun!gorodish!guy From: guy%gorodish@Sun.COM (Guy Harris) Newsgroups: comp.unix.questions,comp.sources.wanted Subject: Re: Multiple Field Sorts in UNIX(tm) Message-ID: <24079@sun.uucp> Date: Thu, 23-Jul-87 15:26:53 EDT Article-I.D.: sun.24079 Posted: Thu Jul 23 15:26:53 1987 Date-Received: Sat, 25-Jul-87 08:45:39 EDT References: <2459@whuts.UUCP> <758@custom.UUCP> <7651@mimsy.UUCP> <2105@sphinx.uchicago.edu> Sender: news@sun.uucp Lines: 23 Xref: mnetor comp.unix.questions:3312 comp.sources.wanted:1696 > Hmm. My sort(1) man page says that you can apply the -n option (and > -dbfir) to individual sort fields, as in: > > $ sort +2n -3 +5df -6 +7n file > > I wonder: is this System V specific (we run SysVr2.1)? Do you BSD users > have these options? *V7* users had those options, which is why both BSD and S5 users have them. From the 4.2BSD manual page: The notation "+'pos1' -'pos2'" restricts a sort key to a field beginning at "pos1" and ending just before "pos2". "Pos1" and "pos2" each have the form "'m'.'n'", optionally followed by one or more of the flags "bdfinr", where "m" tells a number of fields to skip from the beginning of the line and "n" tells a number of characters to skip further. *If any flags are present they override all the global ordering options for this key.* If the "b" option is in effect "n" is counted from the first nonblank in the field; "b" is attached independently to "pos2". Guy Harris {ihnp4, decvax, seismo, decwrl, ...}!sun!guyoups:uptions,h