本文主要是介绍Linux命令(112)之tac,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
linux命令之tac
1.tac介绍
linux命令tac是将文件内容反向输出,其与命令cat输出刚好相反
2.tac用法
tac [参数] filename
参数 | 说明 |
--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 exitGNU 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 aaaaa 145 dd
a 135 dd
a 1[34]5 ddaaa
1 111 111
2 222 222
1 111 111
aaaa bbbb ccccthis is a test line
aaa bbb ccc
this is a test line
123acb111 error 11111123acb111 aaaa bbbb
[root@rhel77 ~]# cat zzz.txt
123acb111 aaaa bbbb123acb111 error 11111
this is a test line
aaa bbb ccc
this is a test lineaaaa bbbb cccc
1 111 111
2 222 222
1 111 111
aaaa 1[34]5 dd
a 135 dd
a 145 ddloveable aaaa
[root@rhel77 ~]#
这篇关于Linux命令(112)之tac的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!