The complete code examples bellow are taken from the original post at Print lines in reverse order
The recommended way:
$ tac file
The more funny way to achieve the same result ;)
#example1 $ cat -n file | sort -k1,1rn | cut -f 2- #example2 $ perl -e 'print reverse <>' file #example3; sorry, this one is not a one line command $ i=0 $ while IFS= read -r arr[i]; do ((i++)); done < file $ for((j=i-1;j>=0;j--)); do printf "%s\n" "${arr[$j]}"; done
No comments:
Post a Comment