shell script for the changing the element of xml [duplicate] shell script for the changing the element of xml [duplicate] shell shell

shell script for the changing the element of xml [duplicate]


Perhaps you mean to use sed.

value='abc'sed -i "s|abc.txt|$value|g" abc.xml

You would have to run that in a shell, or as a shell script with the header #!/bin/sh.

---- Update ----

#!/bin/shvalue="something"sed -i "s|\(<filename>\)[^<>]*\(</filename>\)|\1${value}\2|" abc.xml

Add g to the sed command if you need to replace multiple instances in one line.

sed -i "s|\(<filename>\)[^<>]*\(</filename>\)|\1${value}\2|g" abc.xml