sed itself is a pipeline command that parses standard input. And sed can also replace, delete, add, remove specific lines and so on.
sed [-nefr] [action]
Options and parameters:
-n: Use silent mode. In normal sed usage, all data from STDIN would normally be listed on the screen. But if you add the -n parameter, only the line or action that has been specially processed by sed will be listed.
-e: sed action editing directly on command mode
-f: Write the sed action directly in a file, -f filename can execute the sed action in filename
-r: sed action supports extended regular notation syntax
-i: Modify the contents of the read file directly instead of outputting it to the screen.
Action description: [n1[,n2]] function
n1,n2 : may not exist, generally represents the number of rows selected for action.
function has these thumps in the ground:
a: new, a can be followed by strings, and these strings will appear on a new line
c: replace, c can be followed by strings, and these strings can replace the lines between n1 and n2
d: delete, because it is deleted, there is usually no dong dong after d
i: Insert, i can be followed by strings, and these strings will appear on a new line
p: print, that is, print out a selected data
s: Replace, you can directly perform the replacement work, usually the action of this s can be matched with regular notation