csdn
论坛上的一个问题:
< Codec_Space Codec_SpaceValue="0" />
< HeartBeatCfg HeartBeatRate="16" Mux_HB_DECount="2" Codec_HB_DECount="2" Prov_HB_DECount="2" />
< DC_Public PathValue="dc_user.rft" DefaultUserName="administrator" DefaultUserPassword="12345678" PrivateData="PrivateData" />
< CheckPW TheValue="1" />
< Device_Info VideoInputNum="10" AudioInputNum="1" VideoOutputNum="4" AudioOutputNum="1" />
< StreamTransport ConnectTimes="0" />
< Codec_SockControl Codec_IP="192.168.240.240" Codec_CtrPort="3300" Codec_UDPHeartPort="27229" Codec_LogPort="27235" Link_Internal_Codec="eth2" />
< Mux_SockControl Mux_LogPort="27235" Mux_CtrPort="5000" Mux_IP="192.168.230.230" />
< LinkCfg Link_Internal_Mux="eth1" Link_OutSide="eth3" Link_Internal_Codec="eth2" />
< ControlListen ListenPort="2000" />
< Port1 PortUsage="3" PortEnable="1" PortDevAddr="/dev/ttyS0" PortBaudrate="9" PortByteSize="4" PortParity="0" PortStopBit="1" FlowControl="0" />
< Port2 PortUsage="2" PortEnable="1" PortDevAddr="/dev/ttyS1" PortBaudrate="9" PortByteSize="4" PortParity="0" PortStopBit="1" FlowControl="0" />
< Port3 PortUsage="4" PortEnable="1" PortDevAddr="/dev/ttyS2" PortBaudrate="9" PortByteSize="4" PortParity="0" PortStopBit="1" FlowControl="0" />
< Port4 PortUsage="5" PortEnable="1" PortDevAddr="/dev/ttyS3" PortBaudrate="9" PortByteSize="4" PortParity="0" PortStopBit="1" FlowControl="0" />
< Port5 PortUsage="7" PortEnable="1" PortDevAddr="/dev/ttyS4" PortBaudrate="13" PortByteSize="4" PortParity="0" PortStopBit="1" FlowControl="0" />
< Port6 PortUsage="1" PortEnable="1" PortDevAddr="/dev/ttyS5" PortBaudrate="9" PortByteSize="4" PortParity="0" PortStopBit="1" FlowControl="0" />
< OSDBaseInfo InputOSDCount="10" />
< InputOSD_ID1 OSD_Script="Input1" InputVSID="1" FontSize="10" FontSpace="0" Position="1" RedColor="255" GreenColor="255" BlueColor="255" Enable="0" />
< InputOSD_ID2 OSD_Script="Input2" InputVSID="2" FontSize="10" FontSpace="0" Position="1" RedColor="255" GreenColor="255" BlueColor="255" Enable="0" />
< InputOSD_ID3 OSD_Script="Input3" InputVSID="3" FontSize="10" FontSpace="0" Position="1" RedColor="255" GreenColor="255" BlueColor="255" Enable="0" />
< InputOSD_ID4 OSD_Script="Input4" InputVSID="4" FontSize="10" FontSpace="0" Position="1" RedColor="255" GreenColor="255" BlueColor="255" Enable="0" />
< InputOSD_ID5 OSD_Script="Input5" InputVSID="5" FontSize="10" FontSpace="0" Position="1" RedColor="255" GreenColor="255" BlueColor="255" Enable="0" />
< InputOSD_ID6 OSD_Script="Input6" InputVSID="6" FontSize="10" FontSpace="0" Position="1" RedColor="255" GreenColor="255" BlueColor="255" Enable="0" />
< InputOSD_ID7 OSD_Script="Input7" InputVSID="7" FontSize="10" FontSpace="0" Position="1" RedColor="255" GreenColor="255" BlueColor="255" Enable="0" />
< InputOSD_ID8 OSD_Script="Input8" InputVSID="8" FontSize="10" FontSpace="0" Position="1" RedColor="255" GreenColor="255" BlueColor="255" Enable="0" />
< InputOSD_ID9 OSD_Script="Input9" InputVSID="9" FontSize="10" FontSpace="0" Position="1" RedColor="255" GreenColor="255" BlueColor="255" Enable="0" />
< InputOSD_ID10 OSD_Script="Input10" InputVSID="10" FontSize="10" FontSpace="0" Position="1" RedColor="255" GreenColor="255" BlueColor="255" Enable="0" />
< RemoteInputOSD OSD_Script="RemoteSource" InputVSID="0" FontSize="10" FontSpace="0" Position="1" RedColor="255" GreenColor="255" BlueColor="255" Enable="0" />
< _TimeOSDBaseInfo1 Xpos="0" Ypos="0" RedColor="0" GreenColor="0" BlueColor="0" Enable="0" />
< BackgroundBaseInfo Enable="0" />
< _TimeOSDBaseInfo2 Xpos="0" Ypos="0" RedColor="0" GreenColor="0" BlueColor="0" Enable="0" />
< RemoteSource Enable="1" />
例如我要增加节点DC_SerialProt的子节点Port2的属性 ProtSize="56" 用sed命令如何做呢,首先我得定位节点DC_SerialProt的内容,然后再其中定位子节Port2,然后才能添加属性,改如何做啊。。。大神教教吧
解决方法:
sed -i '//,/<\/DC_SerialProt>/{/< Port2/{s/\/>/ ProtSize="56" \/>/}}' 1.xml
阅读(2812) | 评论(0) | 转发(0) |