Re: Parsing output into a usable format.

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

 



nice!
I've always wanted to learn perl, guess it time to start dabbling.

Thanks for your help, worked like a charm

Can I ask what the code does.

I am guessing the $1 looks at the "2016"; field?  then I am lost

:)

Paul

On 09/03/07, Dave Mitchell <davem@xxxxxxxxx> wrote:
On Fri, Mar 09, 2007 at 11:40:08AM +0000, Paul Ward wrote:
> Hi All,
>
> Can someone please lend me a hand to parse the following text into a
> usable format.
>
> I am grepping a web page for a numeric figure that appears only on one
> line using the following
>          #lynx  -source http://172.19.100.127/eng/main.htm|grep  sVal\\[7\\]
> This produces the following output
>          #sVal[7] = "2016";
> I want to be able to extract only the numeric figure so it can be used
> in a expr sum.


#lynx  -source http://172.19.100.127/eng/main.htm | \
                perl -nle 'print $1 if /sVal\[7\]\s*=\s*"(\d+)"/'

--
A major Starfleet emergency breaks out near the Enterprise, but
fortunately some other ships in the area are able to deal with it to
everyone's satisfaction.
    -- Things That Never Happen in "Star Trek" #13

--
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list



[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux