use*_*261 3 command-line cat less
例如,less 允许您从头开始逐行阅读。是否有类似的实用程序或行可以在终端中运行,可以逐个字符地向后显示文件?如果没有,一个“猫”之类的实用程序如何按字符向后显示整个文件?
这样做:
cat /tmp/aa | tac | rev
Run Code Online (Sandbox Code Playgroud)
其中 tac 逐行反转文件,保持字符完整......然后 rev 通过简单地反转每个给定行的字符来完成它,保持逐行完整......所以例如:
cat /tmp/aa
Is there a way to read characters backwards from the end of a file in the terminal?
For instance, less allows you to read line by line, starting from the beginning. Is there a similar utility or line that could be run in the terminal that could display a file backward character by character?
cat /tmp/aa | tac | rev
retcarahc yb retcarahc drawkcab elif a yalpsid dluoc taht lanimret eht ni nur eb dluoc taht enil ro ytilitu ralimis a ereht sI .gninnigeb eht morf gnitrats ,enil yb enil daer ot uoy swolla ssel ,ecnatsni roF
lanimret eht ni elif a fo dne eht morf sdrawkcab sretcarahc daer ot yaw a ereht sI
Run Code Online (Sandbox Code Playgroud)