linux下批量替换目下所有文本文件内容

对象为整个目录以及子目录

1
grep -rl 'windows' ./path | xargs sed -i 's/windows/linux/g'

因为网址有有//,可能需要转录一直不成功,分两部分替换就可以了

1
grep -rl 'www.caotama.com' ./wwwroot | xargs sed -i 's/www.caotama.com/www.cao.com/g'
1
grep -rl 'https' ./wwwroot | xargs sed -i 's/https/http/g'

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注