[olug] Unix Tip: OUTPUT A FILE IN REVERSE

William E. Kempf wekempf at cox.net
Tue Apr 22 14:48:17 UTC 2003


Thom Harrison said:
> tac -n  doesn't work to number the lines.  I'm sure a lot of other cat
> options are missing too, but it works as advertised.  :-)

My thoughts from this tip, and in this order:

1) Where do *nix programmers go to learn how to name things?

2) Why would I ever want to list out a text file in reverse line order?
(The few corner cases I can think of would involve heavy file manipulation
where I'd likely right a more sophisticated program/script that would be
more efficient than using 'tac' in a pipe.)

3) Why in the world is this a seperate program?  (If there is a need for
this sort of thing, shouldn't it be a command line switch on cat?)

The last question would immediately solve the '-n' observation above...
though I'd have to question whether or not the line numbers should be
reversed as well in this case?

>
> Thom
>
> ----- Original Message -----
> From: "Unix Guru Universe" <listserv at ugu.com>
> To: <olug at olug.org>
> Sent: Monday, April 21, 2003 2:30 PM
> Subject: [olug] Unix Tip: OUTPUT A FILE IN REVERSE
>
>
>>
>> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>>
>>       UNIX GURU UNIVERSE
>>          UNIX HOT TIP
>>
>> Unix Tip 1937 - April 21, 2003
>>
>>     http://www.ugu.com/sui/ugu/show?tip.today
>>
>> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>>
>>
>> OUTPUT A FILE IN REVERSE
>>
>> A Linux Tip, you flavor
>> may very.
>>
>> If you want to output all
>> the lines in a text file
>> backwords use "tac".  It
>> does just the opposite of
>> cat.
>>
>>
>>
>>
>> --------------------------------------------------------------------------
>> To Subscribe:    http://www.ugu.com/sui/ugu/show?tip.subscribe
>> To Unsubscribe:  http://www.ugu.com/sui/ugu/show?tip.unsubscribe To
>> Submit A Tip: http://www.ugu.com/sui/ugu/show?tip.today
>>
>> ==========================================================================
>> DISCLAIMER: All UNIX HOT TIPS ARE OWNED BY THE UNIX GURU UNIVERSE AND
>> ARE NOT TO BE SOLD, PRINTED OR USED WITHOUT THE WRITTEN CONSENT OF THE
>> UNIX GURU UNIVERSE. ALL TIPS ARE "USE AT YOUR OWN RISK". UGU  ADVISES
>> THAT ALL TIPS BE TESTED IN A NON-PRODUCTION DEVELOPMENT ENVIRONMENT
>> FIRST.
>>
>> Unix Guru Universe - www.ugu.com - tips at ugu.com - Copyright 1994-2001
>> ==========================================================================
>>
>> _______________________________________________
>> OLUG mailing list
>> OLUG at olug.org
>> http://lists.olug.org/mailman/listinfo/olug
>
> _______________________________________________
> OLUG mailing list
> OLUG at olug.org
> http://lists.olug.org/mailman/listinfo/olug


-- 
William E. Kempf




More information about the OLUG mailing list