Operating System - HP-UX
1834957 Members
1826 Online
110071 Solutions
New Discussion

Perl One-Liner -- How to Reverse display a file

 
SOLVED
Go to solution
Alzhy
Honored Contributor

Perl One-Liner -- How to Reverse display a file

Anyone?

I need to display a file (ascii/text) so the last entries are displayed first (not the command tail!).

I remember there is a perl one liner for this but I cannot recall..
Hakuna Matata.
2 REPLIES 2
RAC_1
Honored Contributor
Solution

Re: Perl One-Liner -- How to Reverse display a file

perl -e 'print reverse <>;' file_name
perl -e print scalar reverse <> file_name

Procura may come up with shortest version.

Anil
There is no substitute to HARDWORK
Charlie Rubeor
Frequent Advisor

Re: Perl One-Liner -- How to Reverse display a file

Try

perl -e 'print reverse <>' file1