2014-07-24 76 views
0

我有sed命令XML解析

<connector name="http" protocol="HTTP/1.1" scheme="http" 
    socket-binding="http" 
    enabled="false"/> 

來代替簡單的XML標籤

<connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/> 

如何能夠做到這一點使用sed命令

我試圖通過更換簡單的sed命令,因爲我是初學者使用

sed 's/connector name="http" protocol="HTTP\/1.1" scheme="http" socket-binding="http"/connector name="http" protocol="HTTP\/1.1" scheme="http" socket-binding="http" enable="false"' abcd.xml` 

但我得到的消息

command garbled: s/connector name="http" protocol="HTTP\/1.1" scheme="http" socket-binding="http"/connector name="http" protocol="HTTP\/1.1" scheme="http" socket-binding="http" enable="false" 

回答

1

s/old/new/命令沒有最後的斜線。試試:

sed 's/connector name="http" protocol="HTTP\/1.1" scheme="http" socket-binding="http"/connector name="http" protocol="HTTP\/1.1" scheme="http" socket-binding="http" enable="false"/' abcd.xml