[BASH] Need help replacing multiple lines
Hey, I'm trying to use a script that adds several lines into the middle of httpd.conf. I thought I could use the following: cat httpd.conf | sed -e "s@ AddType application/x-tar .tgz@'$( cat lines_to_add.txt )'@g" But if there's more than one line in lines_to_add.txt sed feaks out with: sed: -e expression #1, char 68: Unterminated `s' command Anyone have an idea what else I can do? I want to keep like lines together (For instance, Files and AddType directives). I really don't wnat to just cat them onto the bottom of the file. Thanks. -- ---------------------------------------------------- Jonathan Wilson System Administrator Clickpatrol.com Cedar Creek Software http://www.cedarcreeksoftware.com
JW
I'm trying to use a script that adds several lines into the middle of httpd.conf. I thought I could use the following:
cat httpd.conf | sed -e "s@ AddType application/x-tar .tgz@'$( cat lines_to_add.txt )'@g"
Experiment with $ sed -e '/AddType application\/x-tar .tgz/r lines_to_add.txt' < httpd.conf
Anyone have an idea what else I can do?
Read a documentation about sed (man page may not be enough). -- Alexandr.Malusek@imv.liu.se
participants (2)
-
Alexandr Malusek
-
JW