在Bash中反转文本文件

如何在 Bash中反转文本文件?

例如,如果some.txt包含以下内容:

book
pencil
ruler

那怎么能得到这个呢? :

relur
licnep
koob
尝试tac和rev命令的组合形式,
$tac file | rev
relur
licnep
koob

来自man tac

tac – concatenate and print files in reverse

来自man rev

The rev utility copies the specified files to standard output,reversing the order of characters in every line. If no files are specified,stan‐ dard input is read.

相关文章

用的openwrt路由器,家里宽带申请了动态公网ip,为了方便把2...
#!/bin/bashcommand1&command2&wait从Shell脚本并行...
1.先查出MAMP下面集成的PHP版本cd/Applications/MAMP/bin/ph...
1、先输入locale-a,查看一下现在已安装的语言2、若不存在如...
BashPerlTclsyntaxdiff1.进制数表示Languagebinaryoctalhexa...
正常安装了k8s后,使用kubect工具后接的命令不能直接tab补全...