4 ms·
I try to avoid Perl when I can (not that sed is much better.) sed -i "s/foo/bar/gi" ./*.txt
by nilved 10y ago
I try to avoid Perl when I can (not that sed is much better.)
sed -i "s/foo/bar/gi" ./*.txt
- shanemhansen 10y agoI actually have trouble remembering perl pie, even though it's got a cute name. Usually I end up running something like this. git grep -l something | xargs sed -i.bak -e 's/something/else/g' Because the longer chain is easier to remember for me.
- sndean 10y agoAwk is a easier for me to remember than sed or perl, just because "sub" (for substitution) is in there: awk '{gsub(/this/,"that")}; 1' Edit: I just learned that "s" in the sed command is for substitute... (http://www.grymoire.com/Unix/Sed.html http://www.grymoire.com/Unix/Sed.html) Well, maybe I'll be able to remember that.
- nilved 10y agoI think you'd like my `git sed` script. https://github.com/devlinzed/dotfiles/blob/master/bin/git-sed https://github.com/devlinzed/dotfiles/blob/master/bin/git-se...