Quantcast
Channel: Extract the Children of a Specific XML Element Type - Unix & Linux Stack Exchange
Browsing all 3 articles
Browse latest View live

Answer by igal for Extract the Children of a Specific XML Element Type

If you really want sed- or awk-like command-line processing for XML files then you should probably consider using an XML-processing command-line tool. Here are some of the tools that I've seen more...

View Article



Answer by Arrow for Extract the Children of a Specific XML Element Type

This may be of help: #!/bin/bash awk -vtag=instance -vp=0 '{ if($0~("^<"tag)){p=1;next} if($0~("^</"tag)){p=0;printf("\n");next} if(p==1){$1=$1;printf("%s",$0)} }' infile Assuming the Sample text...

View Article

Extract the Children of a Specific XML Element Type

Given a specific XML element (i.e. a specific tag name) and a snippet of XML data, I want to extract the children from each occurrence of that element. More specifically, I have the following snippet...

View Article
Browsing all 3 articles
Browse latest View live




Latest Images