Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site noscvax.UUCP Path: utzoo!watmath!clyde!burl!hou3c!hocda!houxm!ihnp4!zehntel!dual!amd!decwrl!decvax!ittvax!dcdwest!sdcsvax!noscvax!kemp From: kemp@noscvax.UUCP (Stephen P. Kemp) Newsgroups: net.unix Subject: Re: reversing lines Message-ID: <624@noscvax.UUCP> Date: Tue, 18-Sep-84 12:47:49 EDT Article-I.D.: noscvax.624 Posted: Tue Sep 18 12:47:49 1984 Date-Received: Tue, 25-Sep-84 04:58:21 EDT References: <2483@pesnta.UUCP>, <334@voder.UUCP>, <222@digi-g.UUCP> <4612@brl-tgr.ARPA> Organization: Naval Ocean Systems Center Lines: 14 On 4.2 bsd systems, the following will work (I think there are no restrictions regarding the file contents): % cat -n filename | sort -nr | sed "s/^.......//" cat -n prefixes the input with lines numbers; sort -nr sorts using the numbers as the sort key, and outputs the lines in reverse order; sed strips the line numbers off again and the result ought to be what you want. Steve Kemp {ihnp4, decvax, akgua, dcdwest, ucbvax}!sdcsvax!noscvax!kemp Computer Sciences Corp. kemp@nosc Naval Ocean Systems Center San Diego, CA