Greg Sabo

A Simple Command-Line Find and Replace

Searching Google never gives me a decent find-and-replace command to use from the command line. Luckily, I came across this while reading the man page for ack:

$ perl -i -p -e's/foo/bar/g' $(ack -f)

I like this approach over using sed because it uses my existing ack configuration to skip files I don’t care about (like .pyc).