I tried to use sed to edit some part of a specific line in a text file and save the change to the original file. OK I now understand that this is not the way sed directly works. But how can I use sed in a script to edit the part of a line with variable content in it? I already used sed to change complete lines or used lines as trigger to cut and insert to a new file. But this is different :) I think what I need is
sed '/baz/s/foo/bar/g'
sed '/beginning of line/s/static text/new static text/g'
This gives me the right output but how can I save it to the source file? I understand that sed outputs to stoud but when I add a ">> outpufile" it gives me an error message
sed: -e Ausdruck #1, Zeichen 55: Unbekannte Option für `s'
Between static text and new static text is some content that changes from time to time so
sed -n '/static text/new static text/,$p' tmp >> source
will work only for as long as the source content hasn't changed.
Any suggestions?
Greetz