linux命令之tac
1.tac介绍
linux命令tac是将文件内容反向输出,其与命令cat输出刚好相反
2.tac用法
tac [参数] filename
tac参数
参数 | 说明 |
--version | 显示版本信息 |
--help | 显示帮助信息 |
3.实例
3.1.显示tac的版本信息
命令:
tac --version
[root@rhel77 ~]# tac --version
tac (GNU coreutils) 8.22
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Jay Lepreau and David MacKenzie.
[root@rhel77 ~]#
3.2.显示tac的帮助信息
tac --help
[root@rhel77 ~]# tac --help
Usage: tac [OPTION]... [FILE]...
Write each FILE to standard output, last line first.
With no FILE, or when FILE is -, read standard input.
Mandatory arguments to long options are mandatory for short options too.
-b, --before attach the separator before instead of after
-r, --regex interpret the separator as a regular expression
-s, --separator=STRING use STRING as the separator instead of newline
--help display this help and exit
--version output version information and exit
GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
For complete documentation, run: info coreutils 'tac invocation'
[root@rhel77 ~]#
3.3.反向显示zzz.txt文件内容
命令:
tac zzz.txt
[root@rhel77 ~]# tac zzz.txt
loveable aaaa
a 145 dd
a 135 dd
a 1[34]5 dd
aaa
1 111 111
2 222 222
1 111 111
aaaa bbbb cccc
this is a test line
aaa bbb ccc
this is a test line
123acb111 error 11111
123acb111 aaaa bbbb
[root@rhel77 ~]# cat zzz.txt
123acb111 aaaa bbbb
123acb111 error 11111
this is a test line
aaa bbb ccc
this is a test line
aaaa bbbb cccc
1 111 111
2 222 222
1 111 111
aaa
a 1[34]5 dd
a 135 dd
a 145 dd
loveable aaaa
[root@rhel77 ~]#
标签:help,--,tac,112,111,Linux,root,rhel77
From: https://blog.51cto.com/ztj1216/8665665