Cat: Stitching files or printing to standard output. Common parameters:-N or default.
[[Email protected] ~]# man catcat (1) user commands cat (1) name cat - concatenate files and print on the standard Outputsynopsis cat [option]... [file] ... Description concatenate file (s), or standard input, to standard output. -a, --show-all equivalent to -vet -b, --number-nonblank number nonempty output lines -e equivalent to -vE -E, --show-ends display $ at end of each line -n, --number number all output lines -s, --squeeze-blank suppress repeated empty output lines -t equivalent to -vT -t, --show-tabs display tab characters as ^i -u (ignored) -v, --show-nonprinting use ^ and M- notation, except for lfd and tab --help display this help and exit --version output version information and exit With no FILE, or when FILE is -, Read standard input. Examples cat f - g &nBsp; output f ' s contents, then Standard input, then g ' s con- tents. cat Copy Standard input to standard output.
1. Default parameter: Print the file to standard output.
[email protected] ~]# cat test.txt testliyaooldboytestjustoldboytest[[email protected] ~]#
2,-n parameter: Print the file to standard output and print the line number of each line.
[[email protected] ~]# cat-n test.txt 1 Test 2 Liyao 3 Oldboy 4 Test 5 just 6 7 Oldboy 8 Test[[email protected] ~]#
3, the use of redirection symbols, input content to the file.
[[email protected] ~]# cat >> test.txt <<EOF> Just for a test> eof[[email protected] ~]# cat-n test.txt 1 Test 2 Liyao 3 Oldboy 4 Test 5 just 6 7 Oldboy 8 Test 9 just for a test[[e Mail protected] ~]#
4,-e parameter: Displays the Terminator, ending with $.
[Email protected] ~]# cat-e test.txt test$liyao$oldboy$test$just$ $oldboy $test$just for a test$
5, stitching the contents of the file, the output of two files to the standard output.
[[email protected] ~]# cat Test.txt testliyaooldboytestjustoldboytestjust for a test[[email protected] ~]# cat just_test.t XT Hello World[[email protected] ~]# cat just_test.txt test.txt Hello worldtestliyaooldboytestjustoldboytestjust for a tes T[[email protected] ~]#
This article is from the "Yau Xin Zhai" blog, please be sure to keep this source http://mofei.blog.51cto.com/6840705/1761965
Cat Command Summary