I needed to replace all
#, inside and only inside the
<faultstring> ... </faultstring> tag. Additionally, the
& should not be changed. Sample input:
123&&<faultcode>IBM.Error<faultstring>special character & and one converted &</faultstring></faultcode>&&123
123&&<faultcode>IBM.Error<faultstring>special character # and one converted &</faultstring></faultcode>&&123
The following one works with the boundary but also replaces the
sed -e :1 -e 's@\(<faultstring>.*\)&\(.*</faultstring>\)@\1#\2@;t1'
Also, I'm replacing those patterns inplace with a file.
PS: I created a new question to avoid confusion on my previous thread. If you guys found that this can be merged on the previous thread please do so. I'm just hoping that new thread will attract people to answer quick, and minimize confusion.