zoukankan      html  css  js  c++  java
  • sed 变量替换

    20.5.101.31_/root>cat aaa
    111"
    222"
    333"
    
    20.5.101.31_/root>cat a2.sh
    for ((i=1;i<=117;i++));
    do
     echo "sed -i '10s/"$/" $i.txt/' aaa" | sed "s/10s/${i}s/"
    done
    
    20.5.101.31_/root>sh ./a2.sh
    sed -i '1s/"$/" 1.txt/' aaa
    sed -i '2s/"$/" 2.txt/' aaa
    sed -i '3s/"$/" 3.txt/' aaa
    
    
    20.5.101.31_/root>cat aaa
    111"
    222"
    333"
    
    20.5.101.31_/root>cat t1.sh
    sed -i '1s/"$/" 1.txt/' aaa
    sed -i '2s/"$/" 2.txt/' aaa
    sed -i '3s/"$/" 3.txt/' aaa
    20.5.101.31_/root>sh ./t1.sh
    20.5.101.31_/root>cat aaa
    111" 1.txt
    222" 2.txt
    333" 3.txt
    
    20.5.101.31_/root>cat a2.sh
    for ((i=1;i<=117;i++));
    do
     #echo "sed -i '10s/"$/" $i.txt/' aaa" | sed "s/10s/${i}s/"
     sed -i "${i}s/"$/" $i.txt/" aaa
    done
    20.5.101.31_/root>cat aaa
    111"
    222"
    333"
    
    20.5.101.31_/root>sh ./a2.sh
    20.5.101.31_/root>cat aaa
    111" 1.txt
    222" 2.txt
    333" 3.txt
  • 相关阅读:
    es6
    vue-router
    vue-lazyload
    java-number2
    echart事件
    weui了解
    java-number
    Java判断语句
    java 循环控制
    The access type for the readers of the blog.
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13349147.html
Copyright © 2011-2022 走看看