You have a log file or whatever file that is in chronological order (oldest record first, the newest records last). And you want to reverse the order.
There is a function in Perl aptly named "reverse" that can perform the task for you.
# cat logfile
1
2
3
# perl -e 'print reverse <>;' logfile
3
2
1
No comments:
Post a Comment