On 14 April 2011 06:24, Jake Peavy <djstunks@xxxxxxxxx> wrote: > On Wed, Apr 13, 2011 at 3:34 PM, Bob Goodwin <bobgoodwin@xxxxxxxxxxxx> > wrote: >> >> I would like to write a script to extract two numbers from the following >> xml file: >> >> <graph caption="Customer: bobgoodwin@xxxxxxxxxxxx" >> xaxisname="Figures Shown Reflect Data Usage in the Last 30 Days" >> yAxisName="Data Usage" bgColor="E3ECF6" showGridBg="1" >> showCanvas="1" numdivlines="4" decimalPrecision="0" >> zeroPlaneColor="CCCCCC" zeroPlaneAlpha="40" numberSuffix="MB"> >> <set name="Actual Usage Upload" value="1088" color="007CC2"/> >> <set name="Usage Threshold Upload" value="5000" color="9CA279"/> >> <set name="Actual Usage Download" value="12667" color="007CC2"/> >> <set name="Usage Threshold Download" value="17000" color="9CA279"/> >> </graph> >> >> The two values I need are in this case the 1988 and the 12667. >> >> <set name="Actual Usage Download" value="12667" color="007CC2"/> >> >> <set name="Actual Usage Upload" value="1088" color="007CC2"/> > Great timing! I have been struggling to get the xpath command line tool to > do something similar with some xml I have. Can anyone solve Bob's question > with xpath? I cannot for the life of me get the xpath syntax right. xpath bob.xml '/graph/set[@name="Actual Usage Upload"]/@value' xpath bob.xml '/graph/set[@name="Actual Usage Download"]/@value' -- Norman Gaywood, Computer Systems Officer University of New England, Armidale, NSW 2351, Australia ngaywood@xxxxxxxxxx Phone: +61 (0)2 6773 3337 http://mcs.une.edu.au/~norm ; Fax: +61 (0)2 6773 3312 Please avoid sending me Word or Power Point attachments. See http://www.gnu.org/philosophy/no-word-attachments.html -- users mailing list users@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines