Cat Command Summary

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.