标签:enable config grep pat 文件 line conf strong code
function addLine() { confFile=configuration.xml isExist=`cat ${confFile} | grep "<listen_enable>"` if [ "X" == "X${isExist}" ] then # 在<listen_port>后追加<listen_enable>行 sed -i ‘/<listen_port>/a\ <listen_enable>true</listen_enable>‘ ${confFile} echo "addLine result:$?" fi }
sed -i ‘/pattern/a\addOne\naddTwo\naddThree‘ file
标签:enable config grep pat 文件 line conf strong code
原文地址:http://www.cnblogs.com/eaglediao/p/7073138.html