Linux全般

概要

複数のファイルで、同じ記述の誤りが特定できた場合に、下記コマンドにて一括で置換することが可能です。

方法1

# grep -lr 文字列 | xargs sed -i "s/文字列A/文字列B/g"

方法2

置換対象文字列:http://hogehoge.com/test01/
置換後の文字列:http://inamuu.com/test02/
置換対象ファイル:*.html

# sed -i "s/http\:\/\/hogehoge\.com\/test01\//http\:\/\/inamuu\.com\/test02\//g" *.html




トップ   編集 凍結 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2022-06-30 (木) 01:40:11