Path: utzoo!attcan!uunet!lll-winken!ames!hc!lanl!cmcl2!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn ) Newsgroups: comp.unix.questions Subject: Re: sorting and reversing lines of a file Message-ID: <9510@smoke.BRL.MIL> Date: 26 Jan 89 23:45:44 GMT References: <9056@burdvax.PRC.Unisys.COM> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 20 In article <9056@burdvax.PRC.Unisys.COM> lang@pearl.PRC.Unisys.COM (Francois-Michel Lang) writes: >(1) reverse the order of lines in a file > but leave the lines themselves intact. > The Unix utility does just the opposite of this. You mean it doesn't leave the lines intact or it doesn't reverse their order? Which utility? Anyway, check for the existence of a "rev" utility on your system. It's standard on all Research UNIXes I know of, including 4BSD, but not on UNIX System V. On a SVID-conformant system, make yourself a shell function or script that does: pr -n9 -t | sort +0nr -1 | cut -f2- Sorting isn't the most efficient way to do this task, but it's easy to implement this way. If you have a LOT of file reversing to do, then probably a real software engineering task should be undertaken.