Command-line tip: replace a word in all files in a directory

Wed, Jun 26, 2013 - 11:37pm -- Isaac Sukin

I need to use this command every once in awhile and I always forget how to do it off the top of my head.

grep -lr --exclude-dir=".git" -e "oldword" . | xargs sed -i '' -e 's/oldword/newword/g'

If you're on Windows you'll need unix command-line tools installed. The easiest way to do that is with Gow.

Here's what each piece does:

Letting Go

Fri, May 17, 2013 - 12:31am -- Isaac Sukin

I recently read something by Aza Raskin that resonated with me. He suggested that delegation -- letting others have ownership over your baby -- is an essential part of leadership that is often inhibited by an attachment to the product, and this attachment comes from the fact that the product's success or failure is a reflection of your own success or failure as the product's leader.

Pages

Subscribe to Isaac Sukin RSS