shell 脚本替换文件中某个字符串
2016-02-24 15:00
260 查看
1、将当前目录下包含jack串的文件中,jack字符串替换为tom
sed -i "s/jack/tom/g" `grep "jack" -rl ./`
2、将某个文件中的jack字符串替换为tom
sed -i "s/jack/tom/g" test.txt
3、不检索某个文件
sed -i "s/jack/tom/g" `grep "jack" -rl --exclude="replacenameofpackage" ./`
sed -i "s/jack/tom/g" `grep "jack" -rl ./`
2、将某个文件中的jack字符串替换为tom
sed -i "s/jack/tom/g" test.txt
3、不检索某个文件
sed -i "s/jack/tom/g" `grep "jack" -rl --exclude="replacenameofpackage" ./`
相关文章推荐
- bash Redirecting_AppendingRedirecting_HereDocument_HereString_etc
- 文章标题
- xshell 输入w 命令后报错 66 column window is too narrow
- bash: hadoop: command not found
- linux_shell_HERE Document
- linux shell读写mysql
- awk和shell变量交互
- linux shell中的数组和关联数组
- linux shell 字符串操作…
- shell 调用mysql存储过程
- linux shell mysql&nbsp…
- linux shell 操作mysql
- linux shell的here document用法(cat << EOF)
- linux shell 字符串操作(长度,查找,替换)详解
- .bash_profile 与 .bashrc 的区别
- shell中条件判断if中的-z到-d的意思
- Shell 传递参数
- PowerShell 删除指定的Shadow Copy
- git bash 命令行
- 2016新年Bash的CVE-2014-6271漏洞修复经历