开发者

Edit files with template

I have a lot of files which consist of some string. I have to remove it from all of files. How can I do this faster? Any ideas, pre开发者_JAVA技巧fer python-script, for example. Thanks.


sed -i "s/YOUR_STRING//g" *

/* or */
for file in `grep YOUR_STRING -l *`; do sed -i "s/YOUR_STRING//g" $file; done

first method will blindly remove the YOUR_STRING for all files

second method probably will break if too many files matched

updated : is not a python solution, ping me if you dislike and will delete it


sed -ie "s/SEARCH/REPLACEMENT/g" *

http://www.grymoire.com/Unix/Sed.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜