以下の内容はhttps://iww.hateblo.jp/entry/20190723/grepより取得しました。


再帰的にファイル内の文字列を検索して置換する

http://hoge.example.comhttps://hoge.example.com に置き換えるやつ

# findでやる方法
find . -type f | xargs sed -e 's/http:\/\/hoge\.example\.com/https:\/\/hoge.example.com/m' -i

# grepでやる方法
grep -rIl http://hoge.example.com . | xargs sed -e 's/http:\/\/hoge\.example\.com/https:\/\/hoge.example.com/m' -i

grepのオプション

-r 再帰
-I バイナリは無視
-l ファイル名表示だけ

findだと検索対象にバイナリも含んでしまうし、全ファイルのタイムスタンプが書き換わってしまう。
grepなら対象を選べるし、バイナリも除外できるし、タイムスタンプの更新も必要最小限にできるので、grepをちゃんと使おう




以上の内容はhttps://iww.hateblo.jp/entry/20190723/grepより取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14