How to use: Cat [-ABEENSTTUV] [--help] [--version] FileName
Description: Connect the file string to the basic output (screen or add > FileName to another 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 when you encounter a blank line that has more than two consecutive lines, replace the blank line with one line
- V or--show-nonprinting
Example:
cat-n textfile1 > Textfile2 Add the file contents of the Textfile1 and enter the Textfile2 file .
cat-b textfile1 textfile2 >> textfile3 Append the contents of the Textfile1 and Textfile2 to the textfile3 after adding the line number (blank line not added) to the file.
Example:
Add a line number to the Textfile1 file and enter the Textfile2 file .
cat-n textfile1 > Textfile2
Append the contents of the Textfile1 and Textfile2 files to the textfile3 after adding the line number (blank line not added).
cat-b textfile1 textfile2 >> textfile3
cat/dev/null >/etc/test.txt This is for emptying/etc/test.txt archive content
cat can also be used to make image file. For example, to make a soft disc image file, put the floppy
cat/dev/fd0 > OUTFILE
Conversely, if you want to write the image file to a floppy disk, please call
cat img_file >/dev/fd0
Note:
1. OUTFILE refers to the image file name of the output.
2. Img_file refers to image FILE.
3. If the device is written back from image file, the device capacity needs to be equivalent.
4. Usually used in the production of the boot magnetic chip.
There are three major features of cat:
1. Display the entire file at once. $ cat FileName~,y6;e
2. Create a file from the keyboard. $ cat > FileName0#!7
only new files can be created and existing files cannot be edited.: z)
3. Merge several files into one file. $cat file1 file2 > File"
?=\
Parameters:P:ds
-N or--number the number of rows for all outputs starting from 1\R5
-B or--number-nonblank and-n similar, except for blank lines not numbered|,3s
- s or--squeeze-blank when you encounter a blank line that has more than two consecutive lines, replace the blank line with one line!s
- V or--show-nonprintingTDS? O
Example:' @uq *y
cat-n textfile1 > Textfile2 Add the file contents of the Textfile1 and enter the Textfile2 file .D
cat-b textfile1 textfile2 >> textfile3 Append the contents of the Textfile1 and Textfile2 to the textfile3 after adding the line number (blank line not added) to the file. ; L-#pj
Example:+hu
Add a line number to the Textfile1 file and enter the Textfile2 file .Z] g=
cat-n textfile1 > Textfile2V "Z&r3
Append the contents of the Textfile1 and Textfile2 files to the textfile3 after adding the line number (blank line not added). rg.7n
cat-b textfile1 textfile2 >> textfile31m?1o
cat/dev/null >/etc/test.txt This is for emptying/etc/test.txt archive contentJ2FX
cat can also be used to make image file. For example, to make a soft disc image file, put the floppy{ZQ
cat/dev/fd0 > OUTFILE%w~ik.
Conversely, if you want to write the image file to a floppy disk, please callGK "D
cat img_file >/dev/fd0e
Note:© Newboys--Newboys general forum G
1. OUTFILE refers to the image file name of the output. +cmcct
2. Img_file refers to image FILE. Ew
3. If the device is written back from image file, the device capacity needs to be equivalent. $;28
4. Usually used in the production of the boot magnetic chip.
Transferred from: http://linux.chinaunix.net/techdoc/system/2007/11/16/972467.shtml