简体   繁体   English

Bash程序以相反的顺序显示文件的每一行

[英]Bash program that displays each line of a file in reverse order

I have a file 我有一个档案

foo
boo
stuff

and I would like to have 我想要

oof
oob
ffuts

Is there any bash utility that will do this for me? 是否有任何bash实用程序将为我做到这一点?

You could use rev command. 您可以使用rev命令。

rev file

From man rev man rev

The rev utility copies the specified files to standard output, reversing the order of characters in every line. rev实用程序将指定的文件复制到标准输出,从而反转每一行中的字符顺序。 If no files are specified, standard input is read. 如果未指定文件,则读取标准输入。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM