Skip to content
Advertisement

How can I extract text from between two xml tags using sed

I have the following output from curl:

JavaScript

How can I retrieve the text between <id> and </id>? I tried using:

JavaScript

but that results in the entire block of text being printed out instead of just the part between and <id>.

I don’t have the ability to install programs on this box so I’d rather not go through the hassle of manually compiling xmlstarlet, etc, just to extract this one thing.

Advertisement

Answer

Thanks for explaining why you are not doing the obvious with the correct tools

JavaScript

match what you don’t want too (untested)

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement