can you help me write correct sed/awk command to replace rc value from 1 to 6, but only for test1?
<abc>
<an>test1</an>
<nl>std</nl>
<rc>1</rc>
</abc>
<abc>
<an>test2</an>
<nl>std</nl>
<rc>3</rc>
</abc>
<abc>
<an>test3</an>
<nl>std</nl>
<rc>1</rc>
</abc>
I have tried:
sed -i /<an>test1</an>/ s/<rc>1</rc>/<rc>6</rc> input.xml
but seems it has problem with new line encounters?
New contributor
Mateusz Godlewski is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.