替换目录下指定文件内容

来源:互联网 发布:淘宝上的家具怎么安装 编辑:程序博客网 时间:2024/05/04 06:12
#!/bin/bash##USEAGE:# change_str_infile.sh filepath filename old_str new_str;## Get List of Files to Be Replaced#file_list=`find path -name "*" -type f `file_list=`find $1 -name "*" -type f `for fn in $file_listdo ffnt="$fn.temp" echo "Processing $fn ...... " sed "s/$2/$3/g" $fn > $ffnt mv -f $ffnt $fndone