home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.questions
- Path: sparky!uunet!psinntp!jpradley!jpr
- From: jpr@jpradley.jpr.com (Jean-Pierre Radley)
- Subject: Re: a sort question
- Organization: Unix in NYC
- Date: Mon, 14 Dec 1992 03:49:54 GMT
- Message-ID: <1992Dec14.034954.5104@jpradley.jpr.com>
- References: <4564@bimacs.BITNET> <1992Dec11.225522.23590@trebor.uucp>
- Lines: 19
-
- In article <1992Dec11.225522.23590@trebor.uucp> root@trebor.uucp (Bob Stockler) writes:
- >yedidya@bimacs.BITNET (Yedidya Israel) writes:
- >
- >>I want to sort a file according to two keys i.e. lines that equal
- >>first key are compared upon their second key (sort +3-3.10 +3.12-3.14
- >>in my case). My question concerns lines that equals in both keys how
- >>do I guarantee that their order will be kept as in input file ???
-
- The manual says that if all the keys furnished have compared equal, lines
- are then ordered with every byte significant, so you do have to take
- additional measures to preserve the input order in Y. Israel's case.
-
- >One way (I think) to _guarantee_ it would be to pipe the input through "nl"
- >and use the input line numbers appropriately as an additional sort key.
-
- I'm surprised you didn't furnish an awk script to reverse the effects of
- nl (though sed would be more straightforward in this case).
- --
- Jean-Pierre Radley Unix in NYC jpr@jpr.com jpradley!jpr CIS: 72160.1341
-