user3381955
user3381955

Reputation: 47

sed command in UNIX for XML parsing

i have to replace the simple xml tag

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

by

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

how i can achieve this using sed command

i tried to replace by simple sed command as i am beginner using

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`

but i am getting message

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"

Upvotes: 0

Views: 127

Answers (1)

John1024
John1024

Reputation: 113904

The s/old/new/ command is missing the final slash. Try:

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

Upvotes: 1

Related Questions