linux sed 批量替换多个文件中的字符串

sed -i "s/oldstring/newstring/g" `grep oldstring -rl yourdir`

例如:替换/home下所有文件中的www.admin99.net为admin99.net

sed -i "s/www.admin99.net/admin99.net/g" `grep www.admin99.net -rl /home`

这个` 符号是F1下边,tab键上边,数字1左边的那个,不是单引号 '

简单吧,就这么简单,不过我真傻,以前为了实现这个功能,居然写了N长的一个shell.........那个寒啊~~
linux系统相关 | 评论(0) | 引用(0) | 阅读(11601)
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
昵称   密码   游客无需密码
网址   电邮   [注册]
               

验证码 请输入左侧的字母,不区分大小写