![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Facing issue while using xsltproc tp parse XML in bash | shivashankar.g | Shell Programming and Scripting | 3 | 07-16-2009 12:29 PM |
| parse data using sh script | moonbaby | Shell Programming and Scripting | 2 | 02-04-2009 10:43 PM |
| how to make your bash script run on a machine with csh and bash | npatwardhan | Shell Programming and Scripting | 3 | 11-19-2008 04:17 AM |
| passing variable from bash to perl from bash script | arsidh | Shell Programming and Scripting | 10 | 06-04-2008 01:25 PM |
| How do you parse a variable in a bash script? | vertical98 | Shell Programming and Scripting | 3 | 03-18-2008 04:30 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Need to Parse XML from bash script
I am completely new to bash scripting and now need to write a bash script that would parse a XML file and take out values from specific tags. I tried using xsltproc, xml_grep commands. But the issue is that the XML i am trying to parse is not UTF 8. so those commands are unable to parse my XML's or i am unable to find a woraround for that in xsltproc or xml_grep Can some one help me in writing a direct script code (something other than utilities like xsltroc or xml_grep) that would pull me the value of the <url></url> tag irrespective the xml being well formed or not This is the sample xml below Code:
<site>
<form>
<url>http://www.bankoamerica.com/state.cgi?section=signin</url>
<method>GET</method>
</form>
</site>
Note: Use CODE-tags when displaying code, data or logs for better readability and to keep formatting like indention etc., ty. Last edited by zaxxon; 07-16-2009 at 08:59 AM.. Reason: code tags |
|
||||
|
XML parsing in bash
Hi panyam Thanks. This is working fine. The XML that i gave is a small chunk of a very big one. Can this sed command be changed so that it will give me only URL's that starts with http, https or www. I have some places where this url tag occurs and having diffeent values. Code:
<site> <form> <url>http://www.bankofamerica.com</url> <url>https://www.bankofamerica.com</url> <url>www.bankofamerica.com</url> <url>sitekey.bankofamerica.com</url </form> </site> In the above example i just want the first 3 as a result and not the last one. Can you please help Last edited by shivashankar.g; 07-16-2009 at 09:37 AM.. Reason: code tags |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|