The user who tagged this as a duplicate missed the forest for the trees, and their suggested duplicate does not answer this question sufficiently.
Here's a sample of what this string might be:
<mobile_device><general><id>15</id><device_name>iPad</device_name><name>Timmy</name><asset_tag/><id>16</id><device_name>iPhone</device_name><name>Spike</name><asset_tag/></general></mobile_device>
I want to parse this somehow to only end up with:
<id>15</id><id>16</id>
So, remove everything that's not contained between an opening id tag and a closing id tag, and there could potentially be an infinite amount of tags. (Although a more realistic upper limit edge case would be 60,000) There will always be at least 1 pair of tags though.
I've been playing around with sed for this, but variations of this syntax haven't worked at all:
sed 's/.*\(<id>*</id>\).*//'
Many thanks in advance for any guidance!