linux practical command line
2012-11-19 15:22
253 查看
http://www.csdn.net/article/2012-11-15/2811906-practical-command-line-tools
字符串操作:替换 inside shell ${string/substring/replacement}
http://www.cnblogs.com/chengmo/archive/2010/10/02/1841355.html
find -name '要查找的文件名' | xargs perl -pi -e 's|被替换的字符串|替换后的字符串|g'下面这个例子就是将当前目录及所有子目录下的所有pom.xml文件中的
find -name 'pom.xml' | xargs
perl -pi -e 's|http://repo1.maven.org/maven2|http://localhost:8081/nexus/content/groups/public|g'
sed
-i "s/oldString/newString/g" `grep oldString -rl /path`
对多个文件的处理可能不支持,需要用 xargs,
搞定。
变种如下:
grep oldString -rl /path | xargs sed
-i "s/oldString/newString/g"
字符串操作:替换 inside shell ${string/substring/replacement}
http://www.cnblogs.com/chengmo/archive/2010/10/02/1841355.html
find -name '要查找的文件名' | xargs perl -pi -e 's|被替换的字符串|替换后的字符串|g'下面这个例子就是将当前目录及所有子目录下的所有pom.xml文件中的
find -name 'pom.xml' | xargs
perl -pi -e 's|http://repo1.maven.org/maven2|http://localhost:8081/nexus/content/groups/public|g'
sed
-i "s/oldString/newString/g" `grep oldString -rl /path`
对多个文件的处理可能不支持,需要用 xargs,
搞定。
变种如下:
grep oldString -rl /path | xargs sed
-i "s/oldString/newString/g"
相关文章推荐
- busybox-1.17.3/scripts/gcc-version.sh: line 11: arm-linux-gcc: command not found
- The linux command line--part one(一) Learing Shell
- Linux Command Line 解析
- Good habit to read something every night The linux command line
- 15 Practical Linux cURL Command Examples
- The linux command line--part 4 Writing Shell Scripts
- Linux Command Line and....ch13(更多的结构化命令——循环)
- the linux Command Line 学习笔记--mysql命令行导入sql文件到指定数据库的方法
- Linux Command Line and....ch19(sed编辑器)
- Linux环境执行makeclean: line 3: $'\r': command not found报错
- linux command line
- The difference between && and ; in the Linux command line
- linux command Line and shell script bible(笔记五)
- 18 Command Line Tools to Monitor Linux Performance
- Linux Command Line
- 《The Linux Command Line》 读书笔记04 Linux用户以及权限相关命令
- Linux Command Line 详细解析
- 20 Command Line Tools to Monitor Linux Performance
- Linux Command Line Basics
- Linux Command Line and....ch4(更多的bash shell)