First in the slot ads: want to go into a folder to see the following files must have permission to execute this file folder.
Sed
P prints the corresponding line 2p prints the second line.
-N outputs only rows processed by the SED command
Look at the Picture it is not very good at speech.
The second line is printed, but the others are printed.
At the same time, SED can also be placed behind the pipe symbol, see figure
d delete the specified line sed "1,2d" deletes 1, 2 rows from which you can see that line 12th is missing. But there is no real deletion of the contents of the original file. It was just deleted at the time of the output.
The-I operation also affects the original file Sed-i "1d" delete the first line and also delete the inside of the source file. (This is a good test)
A operation is added after this line.
The I action is added before this line.
Neither of these will affect the original file if you want to change the original file plus the-I operation.
C Operation SED "1c 999999" Cut1.txt first line replaced with 999999
s:s/old character/new character/g:sed s/xiaoq/xiaoq/g replace (no line number works on entire document)
You can also specify a line to replace 22 with Xiaoq
The SED syntax for Shell programming