Analysis of an example of adding a blank line above and below a sed matching line
This article mainly introduces the example analysis of adding a blank line above and below the sed matching line. The article is very detailed and has a certain reference value. Interested friends must read it!
Sed'/ regex/ {x _ Tinct _ x _ TX _ G;}'
Mode space is pattern space in sedline; keep space is hold space
Step 1, the pattern space gets the regex matching row, leaving the space empty
Step 2 Pert x to maintain the exchange of space and pattern space
Step 3 dint p executes, printing as an empty pattern space, keeping the space as the regex matching line
Before the execution of step 4 regex x, because the matching line cannot be found, the pattern space is empty and the space is kept as the first matching row.
After the execution of step 5 regex x, the pattern space matches the row for the first time, leaving the space blank
Step 6, after the execution of par G, add the hold space to the pattern space matching line
The above is all the contents of the article "sample Analysis of adding a blank line above and below the sed matching line". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!