特定目录字符查找替换 sed -i 's/old/new/g' $(grep -lR old /path)
2012-08-29 15:52
344 查看
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
指令:
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
相关文章推荐
- 查找和替换指定目录下所有文件中字符串(use sed and grep)
- sed 替换 目录 文件 某个特定字符
- linux命令grep查找指定目录中包含特定字符
- sed 替换特定字符,字符串
- ubuntu 查找含有特定字符的文件并复制到指定目录
- sed和grep, 查找全部文件并替换
- sed替换特定字符
- 用grep查找指定目录及其子目录下的特定文件类型
- grep查找字串sed替换字串
- Shell Sed 替换特定行特定字符
- sed `grep` 查找并替换
- linux下用sed和grep命令替换目录下所有文件中的字符串
- sed替换所有目录下特定文件
- grep查找目录下的文件里的字符
- 查找特定目录下包含特定字符的文件
- 查找特定目录下包含特定字符的文件
- 如何替换某文件中的所有的特定字符?---linux sed命令(文本编辑命令) (转载)
- 如何替换某文件中的所有的特定字符?---linux sed命令(文本编辑命令)
- 查找目录下的所有文件中是否含有某个字符串 :正则表达式、find、grep、xargs、awk、sed等
- linux下用sed和grep命令替换目录下所有文件中的字符串