Script to extract data -
Bob Goodwin
bobgoodwin at wildblue.net
Fri Apr 15 08:34:53 UTC 2011
On 14/04/11 19:09, Cameron Simpson wrote:
> On 13Apr2011 16:11, Bob Goodwin<bobgoodwin at wildblue.net> wrote:
> | On 13/04/11 15:47, Dave Ihnat wrote:
> |> [ grep | sed approach ... ]
> |
> | [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!
> |
> | As I said I can muddle through from there, that was the hard part.
>
> Never forget that sed can do what grep does, so (untested, one line):
>
> sed -n '/Actual Usage Download/s/.*value="\([^"]*".*/\1/p'< /home/bobg/foo
>
> Cheers,
This morning's data:
[bobg at box9 ~]$ cat foo
<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="1094" color="007CC2"/>
<set name="Usage Threshold Upload" value="5000" color="9CA279"/>
<set name="Actual Usage Download" value="12012" color="007CC2"/>
<set name="Usage Threshold Download" value="17000" color="9CA279"/>
</graph>
[bobg at box9 ~]$ sed -n '/Actual Usage
Download/s/.*value="\([^"]*".*/\1/p' < /home/bobg/foo
sed: -e expression #1, char 49: Unmatched ( or \(
I thought perhaps a permissions problem?
[bobg at box9 ~]$ su
Password:
[root at box9 bobg]# sed -n '/Actual Usage
Download/s/.*value="\([^"]*".*/\1/p' < /home/bobg/foo
sed: -e expression #1, char 49: Unmatched ( or \(
I am not familiar with sed and the commands are overwhelming [to
me]. Man sed hasn't helped ... I am interested.
Perhaps you can tell me what's wrong?
Thanks much.
Bob
More information about the users
mailing list