In below XML snipped, I need to delete the unwanted lines matching an artifact ID value:
<groupID>com.test</groupID>
<artifactID>nginx-node</artifactID>
<verion>1.0</version>
<groupID>com.test</groupID>
<artifactID>nginx-node</artifactID>
<verion>1.1</version>
<groupID>com.test</groupID>
<artifactID>nginx</artifactID>
<verion>1.2</version>
I need to delete all XML lines current, before and after by matching the value of artifact ID ie "nginx-node" in an above XML file
command tried:
grep -iv "nginx-node" file.
Actual output:
<groupID>com.test</groupID>
<verion>1.0</version>
<groupID>com.test</groupID>
<verion>1.1</version>
<groupID>com.test</groupID>
<artifactID>nginx</artifactID>
<verion>1.2</version
**Expected output:**
<groupID>com.test</groupID>
<artifactID>nginx</artifactID>
<verion>1.2</version>