dreadedmonkeygod . net

sed: global regexp replacement one-liner

A long-forgotten, recently-recovered gem:

sed -i 's/[old]/[new]/g' [filenames]

This will replace all occurrances of [old] with [new] in all the named files.

Readers' Comments

Yo C, I use "s/[old]/[new]/g" all the time in vi... Forgotten? I dunno... :P
I don't use vi, so that probably just got flushed down the memory hole.

Post a Comment

Name:
Email (Never, ever displayed.)
URL:
Remember me next time.
Comments (Sorry, no HTML allowed. Space paragraphs with a blank line.):