<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Read XML with Shell Script Archives - scmGalaxy</title>
	<atom:link href="https://www.scmgalaxy.com/tutorials/tag/read-xml-with-shell-script/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.scmgalaxy.com/tutorials/tag/read-xml-with-shell-script/</link>
	<description>A Platform for Software Engineers</description>
	<lastBuildDate>Sat, 27 Feb 2021 09:53:56 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1</generator>
	<item>
		<title>How to read XML file by using shell script ?</title>
		<link>https://www.scmgalaxy.com/tutorials/reading-xml-file-using-shell-script/</link>
					<comments>https://www.scmgalaxy.com/tutorials/reading-xml-file-using-shell-script/#respond</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Mon, 03 May 2010 06:40:34 +0000</pubDate>
				<category><![CDATA[Shell Script]]></category>
		<category><![CDATA[File]]></category>
		<category><![CDATA[Guide]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Instruction]]></category>
		<category><![CDATA[Process]]></category>
		<category><![CDATA[Read]]></category>
		<category><![CDATA[Read XML File]]></category>
		<category><![CDATA[Read XML file using shell script]]></category>
		<category><![CDATA[Read XML with Shell Script]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[Shell script]]></category>
		<category><![CDATA[shell script for reading xml content]]></category>
		<category><![CDATA[Using]]></category>
		<category><![CDATA[xml]]></category>
		<category><![CDATA[XML File Reading by Shell script]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/2010/05/03/reading-xml-file-using-shell-script/</guid>

					<description><![CDATA[<p>This was like the first time where I had to write something that will be able to read something out [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/reading-xml-file-using-shell-script/">How to read XML file by using shell script ?</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-4367 aligncenter" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2010/05/xml-file-using-shell-script.png" alt="read-xml-file-using-shell-script" width="600" height="400" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2010/05/xml-file-using-shell-script.png 600w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2010/05/xml-file-using-shell-script-300x200.png 300w" sizes="(max-width: 600px) 100vw, 600px" /></p>
<p>This was like the first time where I had to write something that will be able to read something out of a XML file using a shell script. Usually I would use Python/Perl as my favorite choices in such a scenario but in this one I really *had* to do all within a shell script.</p>
<p>This is an example of the type of XML file I had to read:</p>
<p><code>Fixed a new bug<br />
Shoaib Mir<br />
Sun, 02 May 2010<br />
shoaibmir[@]gmail.com</code></p>
<p>I ended up having a shell script like this:<br />
<code><br />
#!/bin/bash</code></p>
<p><code>#Looking for four keywords in here<br />
for key in changelog name date email<br />
do<br />
OUTPT=`grep  $key log.xml | tr -d '\t' | sed 's/^\([^&lt;].*\)$/\1/' `<br />
eval ${key}=`echo -ne \""${OUTPT}"\"`<br />
done</code></p>
<p># Getting the results in four specific arrays<br />
changelogarr=( `echo ${changelog}` )<br />
namearr=( `echo ${name}` )<br />
datearr=( `echo ${date}` )<br />
emailarr=( `echo ${email}` )</p>
<p><code>#Print all Arrays<br />
echo ${changelogarr[@]}<br />
echo ${namearr[@]}<br />
echo ${datearr[@]}<br />
echo ${emailarr[@]}<br />
</code></p>
<p>Which gives me an output:<br />
<code><br />
shoaib@shoaib-desktop:~/Desktop$ ./readxml.sh<br />
Fixed a new bug Shoaib Mir<br />
Sun, 02 May 2010<br />
shoaibmir[@]gmail.com</code></p>
<p>&nbsp;</p>
<p><b>Reference:</b></p>
<blockquote class="wp-embedded-content" data-secret="cc6RXB1pS5"><p><a href="https://shoaibmir.wordpress.com/2010/05/02/reading-xml-file-using-shell-scripting/">Reading XML file using shell&nbsp;script</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  title="&#8220;Reading XML file using shell&nbsp;script&#8221; &#8212; Life in the fast lane..." src="https://shoaibmir.wordpress.com/2010/05/02/reading-xml-file-using-shell-scripting/embed/#?secret=UX3iRl5qM9#?secret=cc6RXB1pS5" data-secret="cc6RXB1pS5" width="600" height="338" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<p>&nbsp;</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/reading-xml-file-using-shell-script/">How to read XML file by using shell script ?</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/reading-xml-file-using-shell-script/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
