今更なんですけど、便利だなぁーと再認識したので
$ find . -name '*.html' | xargs grep -l 'hogehoge' | xargs sed -i.bak 's/hogehoge/fugafuga/g'
1)拡張子が「.html」
2)「hogehoge」という文字列を含んでいる
3)「hogehoge」を「fugafuga」に置換する
ちなみに -i.bak というオプションは [元のファイル名].bak というバックアップファイルまで作ってくれます。
今更なんですけど、便利だなぁーと再認識したので
$ find . -name '*.html' | xargs grep -l 'hogehoge' | xargs sed -i.bak 's/hogehoge/fugafuga/g'
1)拡張子が「.html」
2)「hogehoge」という文字列を含んでいる
3)「hogehoge」を「fugafuga」に置換する
ちなみに -i.bak というオプションは [元のファイル名].bak というバックアップファイルまで作ってくれます。
This entry was posted on 2010/1/29 金曜日, 10:10:10 and is filed under Linux, 技術. You can follow any responses to this entry through RSS 2.0. You can leave a response, or trackback from your own site.
Arclite theme by digitalnature | powered by WordPress