Script to extract data -

Jake Peavy djstunks at gmail.com
Wed Apr 13 20:24:36 UTC 2011


On Wed, Apr 13, 2011 at 3:34 PM, Bob Goodwin <bobgoodwin at wildblue.net>wrote:

> I would like to write a script to extract two numbers from the following
> xml file:
>
>        <graph caption="Customer: bobgoodwin at wildblue.net"
>        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"/>
>
>
> I need to create a script I can run daily to check and record our usage
> in order to stay within our allocation. I can muddle through the rest
> but it would save me a lot of struggling if someone could show me how to
> do this part. My effort so far has not been productive!<http://fedoraproject.org/wiki/Mailing_list_guidelines>
>


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.

Thanks from me too!

-- 
-jp

I'm not afraid of insects taking over the world, and you know why? It would
take about a billion ants just to AIM a gun at me, let alone fire it. And
you know what I'm doing while they're aiming it at me? I just sort of slip
off to the side, and then suddenly run up and kick the gun out of their
hands.

deepthoughtsbyjackhandey.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.fedoraproject.org/pipermail/users/attachments/20110413/c0a99301/attachment-0001.html 


More information about the users mailing list