shell之批量替换

注意:以某个文件作为基准
cat update_cfg | awk '{
print $1" "$2" "$3" "$4" "$5
}'|while read x y z w v
do
        #echo $x" "$w
        cat 13994000007.txt.1010 |while read yy
        do
                echo $yy | grep "$x" | wc -l |read num
                if [ $num -eq 1 ]
                then
                        echo $yy |sed -e "s/13994000007/$w/g"
                else
                        echo $yy
                fi
        done   >> xxx.txt
done
发布了191 篇原创文章 · 获赞 660 · 访问量 25万+

猜你喜欢

转载自blog.csdn.net/m0_37806112/article/details/102546432
今日推荐