Remember my script that sends out HTML emails? Well, that's done, but
it's in-efficient.

The actual script that parses screen-scrapes. Initial script only went
to get the "Last Price" now, I would like to add the "Day Range" 

last_price()
{
value="$(lynx -dump "$url$symbol" | grep 'Last price:' | \
        awk -F: 'NF > 1 && $(NF) != "N/A" { print $(NF) }' )"
}

day_range()
{
day_range="$(lynx -dump "$url$symbol" | grep 'Low \& High:' | \
        awk -F: 'NF > 1 && $(NF) != "N/A" { print $(NF) }' )"
}

The above is in-efficient because I need to call the script to get the
page 2 times.

Doing a 

lynx -dump "$url$symbol" | egrep -i '(Last Price|Low \& High)'| awk -F:
'NF > 1 && $(NF) != "N/A" { print $(NF) }'

will work, but then, there will be 2 values associated with it :
7.35
      7.127 - 7.38

Can anyone help with a better awk script so that each value will be
associated with each line?

eg:
last_price=7.35
day_range=7.127 - 7.38

w/o actually piping the lynx output to a file (actually, that would be
the easy way)

On the other hand, how does one use awk for multigreps like egrep '(pop|
test)'

I've tried variation of 
1. awk "/Low & High/"
2. awk "/Low & High/" && /Last/
3. awk '{"/Low & High/" && /Last/}'
all of which doesn't work except for No. 1

-- 
Ow Mun Heng
Gentoo/Linux on DELL D600 1.4Ghz 1.5GB RAM
98% Microsoft(tm) Free!! 
Neuromancer 13:54:21 up 1 day, 4:11, 6 users, load average: 3.66, 2.92,
2.71 


-- 
gentoo-user@gentoo.org mailing list

Reply via email to