You have forgotten something.
Replace Text In a File In-Place With Sed
May 23rd, 2009
Yeah, yeah, this is common knowledge – but I always forget the proper syntax. :p
Anyhow, say you’ve got a file with ICANHAZCHEEZBURGRZ somewhere in it, and you want to replace that hilarious phrase. Here’s what you do:
sed -i 's/ICANHAZCHEEZBURGRZ/IHAZACHEEZBURGR/' filename
This will replace ‘ICANHAZCHEEZBURGRZ’ with ‘IHAZACHEEZBURGR’.
Such a thing is extremely useful when scripting the configuration of an insane amount of systems. (*wink wink, nudge nudge*)
Note: Still working out comments/etc. theming. Please ignore the ugliness.