[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: 问一个sed的问题



如果你的sed有-i选项
sed -i -e 's/xxxxx/sssss/' *.html
如果没有可以用一个简单的脚本
-----------------------------
#!/bin/sh

for file in `ls *.cpp`;do
sed -e 's/xxxxx/ssss/' $file >tmpfile
cp tmpfile $file
done
rm -f tmpfile
-----------------------------

去掉/*xxxxxxxxx*/样式的注释

sed -r -e 's/\/\*.*\*\///g' test.cpp

jun yu 写道:
> sed默认是输出到stdout里,但是当我需要对多个文件进行替换操作时,就有问
> 题了,比如:
>
> sed -e 's/xxxxx/sssss/' *.html
>
> html文件有很多个,不知道怎么样才能替换多个文件。
>
> 感觉应该是通过多个命令行工具组合来进行,但是就是一下子想不明白。
>
> 谁有这方面的经验吗?



Reply to: