In a world of Perl, sed seems to be an archaic method of doing things reserved to the real brave geeks!
But sometimes sed does perfectly fantastic job, like it did for me few minutes ago… with some caveats.
My goal was to replace $i with the value of the variable, determined by the first part of the script:
for i in `seq 1 50`;
the problem was that I made rest of the cycle as follows:
do cat newtest.xml|sed –e ‘s/variable/$i/’ >> multifirewallimport.xml; done
and the result was that through all my file the word variable was replaced with the word $i.
What was wrong? Well… Googling for it I discovered the issue was in usage of single quote instead of double quote.
The correct form is:
for i in `seq 1 50`; do cat newtest.xml|sed -e "s/variable/$i/" >> multifirewallimport.xml; done