I have the following output
<computers><size>5</size><computer><id>1</id><name>NSK1210050726M</name></computer><computer><id>2</id><name>nsk1200015739m</name></computer><computer><id>3</id><name>SFO1502083053M</name></computer><computer><id>5</id><name>nsk1501817326m</name></computer><computer><id>8</id><name>nsk1501901173m</name></computer></computers>
and I want to get only the names inside of tags using shell scripting.
How can I accomplish this?
If your xml is in a shell variable, say
$XMLthen you can use shell parameter substitution and a simple loop to do a really bad job of parsing it.But really, REALLY, using something like xml starlet suggested by @Brian Agnew is a much better idea.