Deep usage of Linux cat

Source: Internet
Author: User

The order is based on the CENTOS6 series, and the translation is based on the official original meaning.



Cat

Cat-concatenatefiles 1117.www.qixoo.qixoo.com and print on the standard output connection file and printout

Cat [OPTION] ... [FILE] ...

Description 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 outputlines

-T equivalent TO-VT

-T,--show-tabs

Display TAB characters as ^i

-U (ignored)

-V,--show-nonprinting

Use ^ and m-notation, except FORLFD and TAB

-a displays all and ends with a $ sign, equivalent to-vet, with low utility.

-B Displays all non-empty line numbers. That is, if it is a blank line, the line number is not displayed

-N Displays line numbers for all rows, including blank lines, etc., commonly used

-S compressed blank line, understood to encounter more than three lines of empty lines, only one row, chicken ribs parameter



Concatenate usage of cat:

To create or direct a file for the input content, format:

cat>>file<< XXX content xxx End

Of course, you can cat> or >>file directly.

Merging cat file1 file2 > File3

Cases:

[]# Cat >>1.txt<<abc

>1234567

>abc

[]# Cat>2.txt

Abcdefg

^c

[]# Cat 1.txt 2.txt

1234567

Abcdefg

[]# cat 1.txt 2.txt > 3.txt

[]# Cat 3.txt

1234567

Abcdefg

The above uses 2 different ways to create files and merge the content together.



Print standard output:

Cat+option+file will know Linux, not introduce



Summary: Cat is described in official info, and his usage is to connect and output file contents. It's just that very few people use it in the connection section. Most people only know cat print standard output. When you want to write a simple script, you can write it directly with Cat. Equivalent to an enhanced echo. Practical work is very practical.

Deep usage of Linux cat

Related Article

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.