Skip to content

Instantly share code, notes, and snippets.

@kjirou
Created October 1, 2014 16:33
Show Gist options
  • Save kjirou/091db4b8bd4f08496615 to your computer and use it in GitHub Desktop.
Save kjirou/091db4b8bd4f08496615 to your computer and use it in GitHub Desktop.
ファイルの一部を置換するコマンド
#!/bin/sh
# sed -i は上書き更新オプション
find ./path/do/dir -name '*.coffee' | xargs sed -i "s/foo/bar/g"
# Mac だと sed -i が使えないので、事前に brew install gnu-sed して gsed を使えるようにする
find ./path/do/dir -name '*.coffee' | xargs gsed -i "s/foo/bar/g"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment