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]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux