I have the following lines in an XML file
<User id="10338" directoryId="1" sometext txt text test/>
<User id="10359" directoryId="100" some more text text text/>
<User id="103599" directoryId="100" some more text text text/>
<User id="10438" directoryId="1" sometext txt text test/>
I am trying to remove any lines that start with User id=" but I want to keep the ones that have directoryId="1"
my current sed command is
sed -i '' '/<User id="/d' file.xml
I have looked at A regular expression to exclude a word/string and a few other stack overflow posts but not able to get this to work. Please can someone help me write the regex. I essentially need to delete any lines that start with <User id= but excluding the ones where directoryId="1"