Re: Script to extract data -

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 15Apr2011 04:34, Bob Goodwin <bobgoodwin@xxxxxxxxxxxx> wrote:
| On 14/04/11 19:09, Cameron Simpson wrote:
| >On 13Apr2011 16:11, Bob Goodwin<bobgoodwin@xxxxxxxxxxxx>  wrote:
| >| On 13/04/11 15:47, Dave Ihnat wrote:
| >|>  [ grep | sed approach ... ]
| >|
| >|         [bobg@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@box9 ~]$ cat foo
|        <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="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@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?

No, an unmatched bracket in the expression. Try this:

  sed -n '/Actual Usage Download/s/.*value="\([^"]*\)".*/\1/p' < /home/bobg/foo

All on one line, if the above gets folded.
Note the closing \) I've added.

Cheers,
-- 
Cameron Simpson <cs@xxxxxxxxxx> DoD#743
http://www.cskk.ezoshosting.com/cs/

What the hell is that?
Sounds like Cole Porter to me, sir.     - _Tank Girl_
-- 
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

[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux