xml文件使用sed命令添加多行

#xml文件使用sed命令添加多行
#打印到屏幕
sed -e "32 a\    <control>" service_bak.xml
#新增生效
sed -i "32 a\    <control>\r" service_bak.xml
#打印到屏幕
sed -e "33 a\                <disable_collect_xdr_types></disable_collect_xdr_types>\r" service_bak.xml
#新增生效
sed -i "33 a\                <disable_collect_xdr_types></disable_collect_xdr_types>\r" service_bak.xml
 
#打印到屏幕
sed -e "34 a\                <disable_collect_xdr_types>40,41,42,44,45,51</disable_collect_xdr_types>\r" service_bak.xml
#新增生效
sed -i "34 a\                <disable_collect_xdr_types>40,41,42,44,45,51</disable_collect_xdr_types>\r" service_bak.xml
 
#打印到屏幕
sed -e "35 a\    </control>" service_bak.xml
#新增生效
sed -i "35 a\    </control>\r" service_bak.xml

 

posted @ 2022-03-03 11:52  友情天  阅读(299)  评论(0编辑  收藏  举报