查找替换文件,,,
时间:2010-07-05 来源:badb0y
#!/bin/bash
file=$(find /1 -name "*.shtml")
old=$(grep -o "http://player.youku.com/player.php/.*\.swf" $file)
new=$(echo $old|awk -F/ '{ print "http://static.youku.com/v1.0.0115/v/swf/qplayer.swf?VideoIDS="$6"&isAutoPlay=true&embedid=-&showAd=0"}'|sed 's#\?#\\?#g'|sed 's#\&#\\&#g')
echo $new
sed -i "s#$old#$new#g" $file find /1 -name "*.shtml"|grep -o "http://player.youku.com/player.php/.*\.swf"|while read old
do
new=$(echo $old|awk -F/ '{ print " http://static.youku.com/v1.0.0115/v/swf/qplayer.swf?VideoIDS="$6"&isAutoPlay=true&embedid=-&showAd=0"}'|sed 's#\?#\\?#g'|sed 's#\&#\\&#g')
echo $new
sed -i "s#$old#$new#g" $file
done
find /1 -name "*.shtml"|xargs sed -ri 's#http://player.youku.com/player.php/.*sid/(.*)/v.swf#http://static.youku.com/v1.0.0115/v/swf/qplayer.swf\?VideoIDS=\1\&isAutoPlay=true\&embedid=-\&showAD=0#g'
old=$(grep -o "http://player.youku.com/player.php/.*\.swf" $file)
new=$(echo $old|awk -F/ '{ print "http://static.youku.com/v1.0.0115/v/swf/qplayer.swf?VideoIDS="$6"&isAutoPlay=true&embedid=-&showAd=0"}'|sed 's#\?#\\?#g'|sed 's#\&#\\&#g')
echo $new
sed -i "s#$old#$new#g" $file find /1 -name "*.shtml"|grep -o "http://player.youku.com/player.php/.*\.swf"|while read old
do
new=$(echo $old|awk -F/ '{ print " http://static.youku.com/v1.0.0115/v/swf/qplayer.swf?VideoIDS="$6"&isAutoPlay=true&embedid=-&showAd=0"}'|sed 's#\?#\\?#g'|sed 's#\&#\\&#g')
echo $new
sed -i "s#$old#$new#g" $file
done
find /1 -name "*.shtml"|xargs sed -ri 's#http://player.youku.com/player.php/.*sid/(.*)/v.swf#http://static.youku.com/v1.0.0115/v/swf/qplayer.swf\?VideoIDS=\1\&isAutoPlay=true\&embedid=-\&showAD=0#g'
相关阅读 更多 +