Three main features of the Linux Cat command

Source: Internet
Author: User

There are three main features of the Linux Cat command:
The 1,cat command displays the entire file at once.
$ cat FileName
The 2,cat command creates a file from the keyboard.
$ cat > FileName
Only new files can be created and existing files cannot be edited.
The 3,cat command merges several files into one file.
$ cat file1 file2 > file
Parameters:
-N or--number the number of rows for all outputs starting from 1
-B or--number-nonblank and-n similar, except for blank lines not numbered
-S or--squeeze-blank
A blank line that is substituted for a row when it encounters a blank line that has more than two consecutive lines
-V or--show-nonprinting
Example:
Cat-n textfile1 > Textfile2 textfile1
The file, add the line number and enter the Textfile2 file.
Cat-b textfile1 textfile2 >> Textfile3 put Textfile1 and
Textfile2 the contents of the file plus the line number (blank line not added) after attaching the content to the
In the Textfile3.
Example:
Add a line number to the Textfile1 file and enter the Textfile2 file.
Cat-n textfile1 > Textfile2
Put Textfile1 and Textfile2
The contents of the file are appended to the TEXTFILE3 after adding the line number (blank line not added)
In
Cat-b textfile1 textfile2 >> textfile3
Cat/dev/null >/etc/test.txt
This is to empty the/etc/test.txt archive content

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.