Parsing output into a usable format.

Dave Mitchell davem at iabyn.com
Fri Mar 9 11:59:13 UTC 2007


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




More information about the fedora-list mailing list