sed execution

Sed [Option] [commands] file
Sed four process executed:
read:
the first line file into memory (Sed own memory space)
performs:
the content of the memory space used to execute commands
to print:
print content (because the order of four execution process is performed sequentially, so the print is the result of the implementation of the contents of commands; should be noted that if not executed commands (such as replacement orders), print file content itself, and finally clear the memory contents
repeated:
reading the second line of the file contents into memory, performing the above process, up until the last line of file

Tip: sed -n commands file:
where -n role is to shield the printing process, namely the implementation of changes to make the process sed: Read -> Execution -> Repeat, because there is no printing process, then there is no screen output;
Commands: the p- Print command
sed -n 'commands p' file: it is a combination of p -n and execute commands to print only the content of

Published 43 original articles · won praise 0 · Views 3047

Guess you like

Origin blog.csdn.net/oTobias/article/details/99591929
sed