I have a XML files with data in it that I need to extract with a Linux Bash Script. For example, I need everything in the brackets and to print out in terminal accordingly (first name in next to first description).
What is the best way to do this? I was able to do it with c# using XPath, but I can't do that simply using a Linux Bash Script correct? I know I can get most of it done with awk, sed, grep, cut ect, but I don't think (actually I know I am not) doing it properly. I am at a point were I extracted description data to a file and name to a file, but after a few hours, I realized this is not the best/proper way.
Example of how it should read is.
- name1 - description1
- name2 - description2
- name3 - (blank)
- name4 - description3
Thank you!
If I can add any detail to make it clearer, please let me know! (Brain is a little fried from a long day at work)
Sample XML (simplified it down to one instance)
<zabbix_export>
<templates>
<template>
<items>
<item>
<name>Available memory</name>
<description>Available memory is defined as free+cached+buffers memory.</description>
</item>
</items>
</template>
<templates>
How it should read out:
<name>Available memory</name> - <description>Available memory is defined as free+cached+buffers memory.</description>
<name>Another Name</name> - <description>Another Description</description>
<name>Another Name</name> - <description>Another Description</description>
<name>Another Name</name> - <description>Another Description</description>