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
标签:xml,多行,service,打印,sed,屏幕,bak 来源: https://www.cnblogs.com/1218-mzc/p/15959139.html