In sed documentation, we read that "sed works by making only one pass over the input(s)".
I would like to write a sed script (to be run like this : sed -f my_script.sed
), that performs several operations including on the operations that were performed earlier in the script.
Is it possible to perform a second (or n-th) pass on the edited stream content ?
e.g. :
- initial stream content :
titi
- stream content after first pass :
/titi/ i (
/titi/ a )
$ cat test.txt
(
titi
)
- after another pass :
s/(/{/g
s/)/}/g
I would like the output to be
$ cat test.txt
{
titi
}
This is just an example to show that i'd like to perform stream editions that have effects on previous commands inside a single .sed
script.