利用unix shell批量替换文件中的特殊字符
if
[ $
#
-ne 1 ];then
echo ' usage:COMMAND code '
return ;
fi
code = $ 1
for FILE in *. sql
do
sed s / ' #CODE# ' / " $code " / g $FILE > / tmp / tmp
mv / tmp / tmp $FILE
echo " File $FILE dealt. "
done
#用cut命令取得文件名12-100位的字符串
filename=`echo $FILE |cut -c12-100`
echo ' usage:COMMAND code '
return ;
fi
code = $ 1
for FILE in *. sql
do
sed s / ' #CODE# ' / " $code " / g $FILE > / tmp / tmp
mv / tmp / tmp $FILE
echo " File $FILE dealt. "
done
#用cut命令取得文件名12-100位的字符串
filename=`echo $FILE |cut -c12-100`
本文转自永春博客园博客,原文链接:
http://www.cnblogs.com/firstyi/archive/2007/07/12/815267.html
,如需转载请自行联系原作者