One day a Linux command, the third day of the cat command

Command: cat (cat Chinese meaning)

Explain: CAT file and print command connects to the standard output device (such as a display), cat is often used to display the contents of the file

Note: When the file is large, the text on the screen quickly flashed (scroll), users often can not see what is displayed. Thus, generally with more split-screen display command. To control the scrolling, you can press Ctrl + S to stop scrolling; press Ctrl + Q key recovery scrolling. Press Ctrl + C (interrupt) key to terminate execution of the command, and returns Shell prompt.

Syntax:  CAT (Option) (parameters)

 

Here to use Linux because the> symbol, I am here to brief introduction> >> 

>: The result of execution of the current command (the original to be output to the display and other places), redirected to other output devices (such as files, printers), if the same file name and overwrites the source file.

>>: and the above command, in that it is not currently covered by the same document, but added new content later.

 

Options:      

-n or --number: 1 for numbering the number of lines of all outputs; (note number is two front -)

 

 

 

-b or --number-nonblank: -n and similar, but not number blank lines;

-s or --squeeze-blank: when faced with more than two consecutive lines of the blank lines, one line on the blank line substitution;

-A: unprintable character display, the display end of line "$";

or -v --show-nonprinting: Use M- ^ and symbols, in addition to outside LFD and TAB.

-E or --show-ends: display $ at the end of each line.

 

-e: equivalent to "-vE" option;

-t: equivalent to "-vT" option;

 Example: Suppose there gc.log and all.log two folders in the current directory

cat gc.log all.log (simultaneously display the contents of the file gc.log and all.log)

cat all.log (all.log display the contents of a file on the screen)

 

 

cat gc.log all.log> filefeng (the merged file into the file filefeng gc.log and all.log in)

 

 

These are some of the major part of the back to write a few commands based on the above knowledge flexible combination of:

 

The input wang.log in this document after document with line numbers all.log content:

cat -n all.log > wang.log

Red box is the new file you just generated

 

 Red box is the line number

 

Guess you like

Origin www.cnblogs.com/fenglangjuxu/p/11027512.html