文件反转命令tac和字符串反转命令rev

1. tac
将文件的最后一行当作第一行输出,以此类推,比如:
bash-3.1$ cat /etc/passwd | tac | tail -n 3
daemon:x:2:2:daemon:/sbin:/bin/false
bin:x:1:1:bin:/bin:/bin/false
root:x:0:0::/root:/bin/bash

2. rev
用法:rev [file ...]
描述:反转文件每行里的字符串顺序,如果没有指定文件,则从标准输出读取
bash-3.1$ echo 123456789 | rev
987654321

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options