样例:
原内容 https://www.testnet.org/newslist.html?itemId=2&navID=9&itemChildId=1&useNewsToPermission=299
改后内容 https://www.testnet.org/newsList.html?permissionId=114
sed -i -e 's#https:\/\/www.testnet.org\/newslist.html?itemId=2&navID=9&itemChildId=1&useNewsToPermission/https:\/\/www.testnet.org\/newsList.html?itemId=2&navID=9&itemChildId=1&permissionId/g' index.html
sed -i -e 's#newslist.html#newsList.html#g' -e 's#useNewsToPermission=#permissionId=#g' $line
原内容 https://www.testnet.org/newsdetial.html?itemId=0&navID=2&itemChildId=undefined&detialId=10721&pdfPid=299
改后内容 https://www.testnet.org/newsdetail.html?permissionId=114&detialId=44563
find . -name '*.html' |while read line;do sed -i -e '/newsdetial.html?itemId=/s/detialId/detailId/g' -e '/newsdetial.html?itemId=/s/pdfPid/permissionId/g' -e '/newsdetial.html?itemId=/s/newsdetial.html/newsdetail.html/g' $line; done
sed -i -e '/newsdetial.html?itemId=/s/detialId/detailId/g' -e '/newsdetial.html?itemId=/s/pdfPid/permissionId/g' -e '/newsdetial.html?itemId=/s/newsdetial.html/newsdetail.html/g' $line
sed -i -e '/newslist.html?/s/useNewsToPermission/permissionId/g' -e '/newslist.html?/s/newslist.html/newsList.html/g' index.html
sed -i -e '/newsDetial.html?navId=/s/detialId/detailId/g' -e '/newsDetial.html?navId=/s/newsDetial.html/newsdetail.html/g' index.html
find . -name '*.htm' |while read line;do sed -i -e '/newsDetial.html?navId=/s/detialId/detailId/g' -e '/newsDetial.html?navId=/s/newsDetial.html/newsdetail.html/g' $line;done
find . -name '*.html' |while read line;do sed -i -e '/newslist.html?/s/useNewsToPermission/permissionId/g' -e '/newslist.html?/s/newslist.html/newsList.html/g' $line;done
find . -name '*.html'|while read line;do sed -i -e 's#https://www.testnet.org/newsList.html?navID=3&itemChildId=undefined&itemId=7#https://www.testnet.org/newsList.html?permissionId=108#g' $line;done
标签:itemId,permissionId,批量,html,newslist,关键字,sed,line From: https://www.cnblogs.com/mjxi/p/18298361