Hello - I've never posted a real question here before so if this is in the wrong section I apologize. However here's my question:
I want to write a one-liner that goes through a file, finds a search string, replaces with something else and then writes the file. I though sed would be the tool I needed?
I want to search for relayhost = [something and comment that out - here's one of my attempts:
sed 's/relayhost = [smtprelay/#relayhost = [smtprelay/g' <test.txt >test.out
and then I get this:
sed: -e expression #1, char 50: unterminated `s' command
Would someone please help me format this? I've a couple hundred servers I need to make this change on and would rather not manually edit them.
Additionally I have to find another line that is commented out and uncomment it.
Thanks for your help in advance!