您的位置:首页 > 其它

批量修改文件内容

2011-09-07 08:51 176 查看
#!/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 "*.c" -type f `

file_list=`find $1 -name "Make.rules" -type f `

for fn in $file_list

do

ffnt="$fn.temp"

echo "Processing $fn ...... "

sed "s/$2/$3/g" $fn > $ffnt

mv -f $ffnt $fn

done
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: