Script to extract data -

Bob Goodwin bobgoodwin at wildblue.net
Wed Apr 13 20:11:34 UTC 2011


On 13/04/11 15:47, Dave Ihnat wrote:
> On Wed, Apr 13, 2011 at 03:34:41PM -0400, Bob Goodwin wrote:
>> I would like to write a script to extract two numbers from the following
>> xml file:
> There are *so* many ways to do this; one brute-force approach:
>
> Put the following two commands in a file; let's call it "foo":
>
>    grep "Actual Usage Download" foo | sed -e "s/^.*value=\"//" -e "s/\" .*$//"
>    grep "Actual Usage Upload" foo | sed -e "s/^.*value=\"//" -e "s/\" .*$//"
>
> Make the file executable:
>
>    chmod a+rx foo
>
> Then, if your XML file is named bar.xml:
>
>    foo<bar.xml
>
> (If the file isn't in your path, "./foo", etc.)
>
> Cheers,
> --
> 	Dave Ihnat
> 	dihnat at dminet.com

        [bobg at box9 ~]$ grep "Actual Usage Download" /home/bobg/foo | sed
        -e "s/^.*value=\"//" -e "s/\" .*$//"
        12667

        Aha, that works. It's so much easier when you can find someone
        who knows how!

        I said I can muddle through from there, that was the hard part.

        Thanks much.

        Bob




More information about the users mailing list