findで再帰的にファイルを検索してgrep -vでログファイルなどの不要なファイルを除外してsedで置換。
Macのsedのiオプションがlinuxと挙動が違うので-iだけではなく-i ''とする。
find . -type f | grep -v '\.log$' | xargs sed -i '' 's/hoge/fuga/g'
Go to list of users who liked
Share on X(Twitter)
Share on Facebook
More than 5 years have passed since last update.
findで再帰的にファイルを検索してgrep -vでログファイルなどの不要なファイルを除外してsedで置換。
Macのsedのiオプションがlinuxと挙動が違うので-iだけではなく-i ''とする。
find . -type f | grep -v '\.log$' | xargs sed -i '' 's/hoge/fuga/g'
Register as a new user and use Qiita more conveniently
Go to list of users who liked