[wplug] sed kung-fu and the art of kickstart file maintenance
Gabriel L. Somlo
gsomlo at gmail.com
Thu Mar 3 10:02:27 EST 2011
Hi,
I maintain a bunch of kickstart files for a few classes of machines I
deal with. A frequent thing happening in the %post section is that
some config files get edited in a small way, by either appending or
modifying a few lines. I do that using here-documents and sed,
respectively.
Recently, I encountered a situation where I need to insert a few lines
into a config file at a *specific* location. I figured, in order to
stay consistent with my previous style, I'd use sed *and* here-documents
to do the job, but all I could come up was this:
sed -i 's/\[section_title\]/cat/e' /etc/configfile.conf <<EOT
[section_title]
foo
bar
blah
EOT
Is there a way to write something like this without the need to
repeat the string '[section_title'' in the here-document ? Something
more along the lines of the 'a' sed command instead of 's' ?
Or am I making this way too complicated ? :)
Thanks,
--Gabriel
More information about the wplug
mailing list