[[Linux全般]]

*概要 [#rcf19b0a]
複数のファイルで、同じ記述の誤りが特定できた場合に、下記コマンドにて一括で置換することが可能です。~
 
*方法1 [#ufd5712a]
 # grep -lr 文字列 | xargs sed -i "s/文字列A/文字列B/g"

*方法2 [#k7b82a16]
 置換対象文字列:http://hogehoge.com/test01/
 置換後の文字列:http://inamuu.com/test02/
 置換対象ファイル:*.html
 
 # sed -i "s/http\:\/\/hogehoge\.com\/test01\//http\:\/\/inamuu\.com\/test02\//g" *.html
 
~
~

トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS