sorting and reversing lines of a file

Guy Harris guy at auspex.UUCP
Fri Jan 27 19:07:24 AEST 1989


>>(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?

Probably that it does neither; it leaves the lines' order intact, but
doesn't leave the lines themselves intact, because...

>Which utility?

...he probably meant "rev", and...

>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.

...the "rev" on my Sun, which is probably the one from 4BSD, reverses
the *characters* in each *line* of the file, but doesn't reverse the
lines themselves.  The 4.3BSD source is source to a version of "rev"
that does that.  I don't have V7 source or documentation handy, so I
can't check whether the V7 version reversed the characters of lines and
left the lines in the same order or reversed the order of lines but left
the lines intact (but I seem to remember that the documentation may have
claimed that it did the latter).

The 4.3BSD source has an SCCS ID from which I infer that it was written
at Berkeley; "rev" may have been one of those utilities mentioned in the
man page but not distributed (I seem to remember "speak", or whatever
the Votrax-driving utility was, being one of them), or one of the ones
distributed, but not in source form (such as "ppt" or the "ching"
programs), so somebody at Berkeley may have written their own, but (if
the intent was to reverse the lines) gotten it wrong.



More information about the Comp.unix.questions mailing list