shell pipeline to reverse the order of lines.

Kyle Jones kyle at UUNET.UU.NET
Sat Feb 16 06:17:16 AEST 1991


After seeing a couple of programs in Perl and Icon to do this, I
feel compelled to post a shell pipeline solution to this problem.

   cat -n | sort -rn | sed 's/ *[0-9]*.//'

For System V folks whose cat(1) doesn't have -n, just use awk:

   awk '{ printf "%10d\t%s\n", NR, $0 }' | sort -rn | sed 's/ *[0-9]*.//'



More information about the Alt.sources.d mailing list