| Pattern Space |
|
- You can think of 'Pattern Space' as a buffer.
- Each time sed read in a line,
it will be placed here for further editing.
There is one another 'buffer' named Hold Space
- Usually we keep one line in Pattern Space. sed provides
some advanced commands to keep several lines in pattern space
where lines are separated by newline characters.
|
|
Cycle |
|
Each cycle consists of
- Overwriting Pattern Space with next line.
- Execute commands from top of the script on the Pattern Space.
- If the end of the script
(not the data file!)
is reached,
print the contents of Pattern Space
(this default action can be disabled by the '-n' option).
|
|
Hold Space |
|
Another 'buffer', relevant commands are
x,
h,
g,
and G |