Skip to content

Instantly share code, notes, and snippets.

View jackpordi's full-sized avatar

Jack Pordi jackpordi

View GitHub Profile
@funroll
funroll / gist:5504098
Created May 2, 2013 18:07
Example of using sed to replace all matches in multiple files. Using OS X 10.7.5. http://stackoverflow.com/questions/10445934/change-multiple-files/10764000#comment23188250_10764000
$ cd /tmp
$ echo "foo bar baz foo foo quz" > test1
$ echo "bar bar foo bar baz foo quz foo foo" > test2
$ sed -i '.bak' 's/foo/replaced/g' test*
$ tail test1 test2
==> test1 <==
replaced bar baz replaced replaced quz
==> test2 <==
bar bar replaced bar baz replaced quz replaced replaced