#Bash 的 rev 命令
rev [OPTION]... [FILE]...
功能
反转行里的字符。
类型
可执行文件(/usr/bin/rev),属于 util-linux。
参数
OPTION选项:-0,--zero- 以空字符(\0)作为行的分隔符,而不是换行符(\n)-h,--help- 显示帮助-V,--version- 显示版本
FILE- 要查看的文件列表;如果没有指定这个参数则读取标准输入
#示例
$ echo -e "hello\nworld" > 1.txt
$ cat 1.txt
hello
world
$ rev 1.txt
olleh
dlrow
#相关命令
#推荐阅读
#手册
REV(1) User Commands REV(1)
NAME
rev - reverse lines characterwise
SYNOPSIS
rev [option] [file...]
DESCRIPTION
The rev utility copies the specified files to standard output,
reversing the order of characters in every line. If no files are
specified, standard input is read.
This utility is a line-oriented tool and it uses in-memory allocated
buffer for a whole wide-char line. If the input file is huge and
without line breaks then allocating the memory for the file may be
unsuccessful.
OPTIONS
-h, --help
Display help text and exit.
-V, --version
Print version and exit.
-0, --zero
Zero termination. Use the byte '\0' as line separator.
SEE ALSO
tac(1)
REPORTING BUGS
For bug reports, use the issue tracker at
https://github.com/util-linux/util-linux/issues.
AVAILABILITY
The rev command is part of the util-linux package which can be
downloaded from Linux Kernel Archive
<https://www.kernel.org/pub/linux/utils/util-linux/>.
util-linux 2.39.3 2023-11-21 REV(1)