How to Use the Linux-cat command

Source: Internet
Author: User
CAT has three main functions:

 

1. display the entire file at a time

 
Cat filename

2. Create a file from the keyboard

 
Cat> filename

Only new files can be created, and existing files cannot be edited.

3. Merge several files into one

 
Cat file1 file2> File

 

The cat command format is as follows:

 

 
Cat [-abeensttuv] [-- help] [-- version] filename

 

Note: connect the archive string to the Basic output (screen & "> FILENAME" to another archive)
Parameters:
-N or-number indicates the number of all output rows starting from 1.
-B or-number-nonblank is similar to-N, except that the blank row is not numbered.
-S or-squeeze-blank when there are two consecutive blank rows or more, it is replaced by a blank row
-V or-show-nonprinting

 

Example:

 

* Add the row number to the file content of linuxfile1 and enter the file of linuxfile2:

 
Cat-N linuxfile1> linuxfile2

* Add the row number (blank line without adding) to the file content of linuxfile1 and linuxfile2 and then append the content to linuxfile3:

 
Cat-B linuxfile1 linuxfile2> linuxfile3

* Clear the/etc/test.txt File Content

 
CAT/dev/Null>/Etc/test.txt

 

Reference: http://www.9usb.net/200902/linux-cat.html

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.