How to reverse lines of a text file?

后端 未结 9 1036
迷失自我
迷失自我 2021-01-01 10:05

I\'m writing a small shell script that needs to reverse the lines of a text file. Is there a standard filter command to do this sort of thing?

My specific applicatio

9条回答
  •  有刺的猬
    2021-01-01 10:53

    Answer is not 42 but tac.

    Edit: Slower but more memory consuming using sed

    sed 'x;1!H;$!d;x'
    

    and even longer

    perl -e'print reverse<>'
    

提交回复
热议问题