Skip to Content
avatar image
Former Member

XML parsing through shell scritps

Hi,

Am new to scripting. 😊

Am trying to figure out whether can i use bash scripting to parse an xml file.

Parsing is not just pulling out information according to the pattern but its more of a generic parsing. I should identify the xml hierarchy and pull of information. It's not a basic parsing stuff. So what you tech guys suggest for this. Will the basic bash scripts be suffice or should i go for expat xml parser or perl parsing or whatever??

Pls suggest some tools and throw some light in this.

Any help is appreciated.

Thanks in advance.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    May 19, 2008 at 03:40 PM

    Shell scripts by themselves may not be adequate for this. You should look in to using AWK, it's better suited for pattern processing.

    -RK

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 21, 2008 at 09:56 PM

    Hi Karthik,

    WELCOME TO SDN

    please check this link

    http://www.unix.com/shell-programming-scripting/63821-xml-parsing-through-shell-scritps.html

    Best regards,

    raam

    Add comment
    10|10000 characters needed characters exceeded

  • Jun 26, 2008 at 02:00 PM

    Hi,

    I guess it's quite complicated to parse XML using shell scripts (bash etc.)

    If you want to parse XML using a scripting language I suppose you use an adequate library or module available for that scripting language. I prefer PERL.

    There is a lot of stuff available for PERL (see search.cpan.org and type XML as value for your search in order to find some modules)

    Cheers

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 29, 2008 at 01:42 AM

    The xmlstarlet program was designed to both read and transform xml from the shell prompt. It's available at

    http://xmlstar.sourceforge.net/

    Add comment
    10|10000 characters needed characters exceeded