特定目錄字符查找替換 sed -i 's/old/new/g' $(grep -lR old /path)

Sed命令實現目錄下多文件的字符替換


指令: 

              sed -i 's/old/new/g' $(grep -lR old *)


注意:

              -R, -r, --recursive       equivalent to --directories=recurse

                         --include=PATTERN     files that match PATTERN will be examined

                         --exclude=PATTERN     files that match PATTERN will be skipped.

                         --exclude-from=FILE   files that match PATTERN in FILE will be skipped.

              -L, --files-without-match only print FILE names containing no match

              -l, --files-with-matches  only print FILE names containing matches

              -c, --count               only print a count of matching lines per FILE

              -Z, --null                print 0 byte after FILE name

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章