Friday, January 31, 2014

Reverse the order of rows

sed -n '1!G;h;$p' file1 > file2

3 comments:

  1. Actually, a command tac does the job too.

    tac file1 > file2

    ReplyDelete
  2. tac is whimsically reverse of cat command :-)

    ReplyDelete