Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!uwvax!uwmacc!hobbes!root From: root@hobbes.UUCP (John Plocher) Newsgroups: comp.unix.questions,comp.sources.wanted Subject: Re: Multiple Field Sorts in UNIX(tm) Message-ID: <155@hobbes.UUCP> Date: Thu, 23-Jul-87 12:54:40 EDT Article-I.D.: hobbes.155 Posted: Thu Jul 23 12:54:40 1987 Date-Received: Sat, 25-Jul-87 11:54:42 EDT References: <2459@whuts.UUCP> <758@custom.UUCP> <7651@mimsy.UUCP> Reply-To: root@hobbes.UUCP (John Plocher) Followup-To: comp.unix.questions Organization: U of Wisconsin - Madison Spanish Department Lines: 39 Xref: mnetor comp.unix.questions:3316 comp.sources.wanted:1701 +---- Chris Torek writes the following in article <7651@mimsy.UUCP> ---- | >UNIX Sort allows you to do exactly what you want. | ... unless you need a numeric sort on one field but an alphabetical | sorts on another, or if any of the other global sort flags conflict | for two fields. +---- Oops! You must have missed the fine print buried in the middle of the man page :-) The manual page for Sys5r2 sort(1) states: (after giving the options for dictionary order, upper/lower case folding, ASCII only, "month", and numeric compares) : "When ordering options appear before restricted sort key specifications, the requested ordering rules are applied globally to all sort keys. When attached to a specific sort key (described below), the specified ordering options override all global ordering options for that key. "The notation +pos1 -pos2 restricts a sort key to one beginning at pos1 and ending at pos2. ... In the 7th edition manual which "reflects the state of the Berkeley system, December 1979" it states: "The notation +pos1 -pos2 restricts a sort key to one beginning at pos1 and ending at 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 chars to skip further. If any flags are present they override all global ordering options for this key. ... I hope that the behavior of sort(1) has not changed in 4.3BSD! - John -- John Plocher uwvax!geowhiz!uwspan!plocher plocher%uwspan.UUCP@uwvax.CS.WISC.EDU