- cat命令 显示文件
[[email protected] zsh]# cat fstab.s test1:2016 test2:2017 [[email protected] zsh]# cat fstac.s test1:2016 test2:2018 [[email protected] zsh]# cat *.s #合并文件 test1:2016 test2:2017 test1:2016 test2:2018 [[email protected] zsh]# cat *.s | sort #合并和排序文件 test1:2016 test1:2016 test2:2017 test2:2018 [[email protected] zsh]# cat *.s | sort | uniq #合并和排序文件,留唯一行 test1:2016 test2:2017 test2:2018 [[email protected] zsh]# cat *.s | sort | uniq > test.txt #合并和排序文件,留唯一行 [[email protected] zsh]# cat test.txt test1:2016 test2:2017 test2:2018 [[email protected] zsh]# cat /dev/null > test.txt #清除文件内容 [[email protected] zsh]# cat test.txt [[email protected] zsh]#
- tr 替换字符
[[email protected] zsh]# cat fstab.s test1:2016 test2:2017 [[email protected] zsh]# tr 2 3 < fstab.s #2 ⇒ 3 test1:3016 test3:3017 [[email protected] zsh]# tr ‘a-z‘ ‘A-Z‘ < fstab.s #小写 ⇒ 大写 TEST1:2016 TEST2:2017 [[email protected] zsh]# tr ‘a-z‘ ‘A-Z‘ < fstab.s >test.txt #小写 ⇒ 大写 [[email protected] zsh]# cat test.txt TEST1:2016 TEST2:2017 [[email protected] zsh]#
未完待续
时间: 2024-10-14 09:01:01