sort a file in reverse order

Rishi, how very true! :stuck_out_tongue:

"tac" is a non-standard utility but linux at least has it.
"tail -r" is not in Posix, but Solaris has it (even SunOS 5.5.1 has it... I don't have access to an earlier version.)
"sort -r" will sort based on the content of the lines
"tail -n" requires an integer argument and does not reverse the lines

Those sed scripts are standard but they will overflow the size of the hold space for large files. HP-UX documents this as 8192 characters. Both SunOS and HP-UX coredump on large files. The scripts are very clever though! :slight_smile:

Finally, I'm glad to see that no one wasted any time trying our search function. Because this thread is the very first time that anyone has encountered the problem of reversing the lines in a file, there is no point in trying to find an earlier solution. NOT! reversing a list