[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Sed replacement from file



Hi,

I'm writing a script that inserts a line of text into a configuration file.
But it can't be at the end, has to be in an arbitrary point. So I thought
I'd put a line at the point where I want to insert the text, like
"--sed-replace-here--". Thing is, though, I have several lines I want to
insert into the file at that point, and doing this:

s/^--sed-replace-here--$/line one\nline two\nline three/

just puts that one line in there with literal "n"'s where I put the \n. If I
could substitute in multiple lines I would then re-add the
"--sed-replace-here" to the end of them.

Anyway. it would be acceptable to have a file from which to insert text to
replace that line, but I can find information on this nowhere in sed
documentation. Is this possible with Sed? Or can you think of a better way
to accomplish this?

Thanks.

--
-Stephan
http://www.sauerburger.org



Reply to: