cat 可以将文件输出到屏幕或者 > 输出到文件
常用参数:
cat -n filename 将文件filename 编号显示
如:
cat -n test.txt
1 [email protected]
2 [email protected]
3 [email protected]
4 [email protected]
5 [email protected]
6 [email protected]
cat -b filename 编号显示,空白行不编号
再如:
cat -n textfile1 > textfile2 讲textfile1内容加编号之后存到textfile2中
cat /dev/null > filename 清空文件内容
时间: 2024-08-11 14:07:14