Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!seismo!gatech!bloom-beacon!bu-cs!m2c!necntc!custom!boykin
From: boykin@custom.UUCP (Joseph Boykin)
Newsgroups: comp.unix.questions,comp.sources.wanted
Subject: Re: Multiple Field Sorts in UNIX(tm)
Message-ID: <760@custom.UUCP>
Date: Fri, 24-Jul-87 00:06:13 EDT
Article-I.D.: custom.760
Posted: Fri Jul 24 00:06:13 1987
Date-Received: Sat, 25-Jul-87 12:43:09 EDT
References: <2459@whuts.UUCP> <758@custom.UUCP> <7651@mimsy.UUCP>
Organization: Custom Software Systems; Natick, MA
Lines: 28
Summary: UNIX Sort permits different sorts on different fields
Xref: mnetor comp.unix.questions:3320 comp.sources.wanted:1706

In article <7651@mimsy.UUCP>, chris@mimsy.UUCP (Chris Torek) writes:
> In article <758@custom.UUCP> boykin@custom.UUCP (Joseph Boykin) writes:
> >UNIX Sort (as well as our own PC/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.  It should not be too hard to write a stable sort
> for such applications, especially if you let /usr/bin/sort do the
> hard work.  (Note the merge option!)
> -- 
> In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690)
> Domain:	chris@mimsy.umd.edu	Path:	seismo!mimsy!chris

As I said in my original posting, UNIX Sort will do exactly what he
wants, this includes the possibility of doing a numeric sort on one
field and alphabetical on another.  Sort has global options which
effect how the sort is done, i.e. do a numeric sort on all the specified
fields.  Each field may specify it's own sub-options, each of which
override the global options.  Specifically a sort key has the form
m.no where 'm' is the 'm'th field (0 relative), 'n' is the number of characters
from the start of that field and 'o' is zero or more of the flags
b d f i n or r.  If any of these are present they override the
global ordering options (but not the non-ordering options).

Joe Boykin
Custom Software Systems
...necntc!custom!boykin