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