Parsing output into a usable format.
Paul Ward
pnward at googlemail.com
Fri Mar 9 12:17:32 UTC 2007
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 at iabyn.com> 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 at redhat.com
> To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
>
More information about the fedora-list
mailing list