cat命令

#cat file1 file2 file3 ...

#cat file.txt

1 2 3

压缩空白行(将文本中多个空白行压缩为单个)

#cat -s file   (压缩连续的空白行)

#cat -s file | tr -s '\n'    也可以用tr移除空白行  (将多个空白行压缩为单个)

显示制表符

#cat -T file

输出行号

#cat -n file

1    txt

2    txt

3    txt


在cat << EOF>file.tst与下一个EOF行之间的所有文本都会被当作stdin数据

#!/bin/bash

cat <<EOF>file.txt

this is a test file

this is a test file

this is a test file

EOF


#cat file.txt

this is a test file

this is a test file

this is a test file


你可能感兴趣的:(cat命令)