Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!ll-xn!ames!necntc!custom!boykin From: boykin@custom.UUCP (Joseph Boykin) Newsgroups: comp.unix.questions Subject: Re: sort question... Message-ID: <651@custom.UUCP> Date: Thu, 14-May-87 18:06:18 EDT Article-I.D.: custom.651 Posted: Thu May 14 18:06:18 1987 Date-Received: Sat, 16-May-87 11:43:28 EDT References: <303@nugipsy.UUCP> Distribution: na Organization: Custom Software Systems; Natick, MA Lines: 27 Summary: Use -1 In article <303@nugipsy.UUCP>, tcianflo@nugipsy.UUCP (Tom Cianflone) writes: > Using the sort utility, and sorting alphabetically by last name, > you get family #1 and family #2 interleaved, of course, by virtue > of their same last names and first initials. > How would I set up the file so that I could get the sort > utility to: > 1) keep family members together without mixing up names > with other families of the same last name > 2) force the listing of a family group to be in a specified > order, for example, head-of-house followed by children. You would, obviously, have to place some other information in the file. However, sort does allow you to specify multiple sort fields. It will sort using the first key, then sort lines which are common by the subsequent sort keys. That is, you could have a file which has: Last First X where 'X' is A for head of household, B for spouse, C for kids, (D for pets!), etc. To sort by family, and have it sorted by "rank" within family, issue the following command: sort +0 -1 +2 -3 filename This can be expanded to provide the information you were looking for such as keeping people within the same family together, etc. Joe Boykin Custom Software Systems ...{necntc, frog}!custom!boykin