how to grep data from site code example

Example 1: how to grep data from site

#!/bin/bash

wget -q -O hkindex.html http://www.aastocks.com/EN/market/HKIndex.aspx?Index=VHSI
rm -f cq
cat hkindex.html | grep -A 23 '' > indextable

#cat indextable | grep '>VHSI<' > vhsivalue
cat indextable | grep '>HSI<' | awk -F '[<|>]' '{print $3 "\t" $7}' > hsis
cat indextable | grep '>HS Red-chip<' | awk -F '[<|>]' '{print $3 "\t" $7}' >> hsis
cat indextable | grep '>HSCEI<' | awk -F '[<|>]' '{print $3 "\t" $7}' >> hsis
cat indextable | grep '>GEM<' | awk -F '[<|>]' '{print $3 "\t" $7}' >> hsis
cat indextable | grep '>HSI FIN<' | awk -F '[<|>]' '{print $3 "\t" $7}' >> hsis
cat indextable | grep '>HSI UTI<' | awk -F '[<|>]' '{print $3 "\t" $7}' >> hsis
cat indextable | grep '>HSI PROP<' | awk -F '[<|>]' '{print $3 "\t" $7}' >> hsis
cat indextable | grep '>HSI COM&IND<' | awk -F '[<|>]' '{print $3 "\t" $7}' >> hsis
cat indextable | grep '>VHSI<' | awk -F '[<|>]' '{print $3 "\t" $7}' >> hsis

cat hsis

Example 2: how to grep data from site

#!/bin/bash
#filename: get_quote.sh
#author: Chao Wang

rm -f $1quote.html
wget -q -O $1quote.html http://www.aastocks.com/en/stock/DetailQuote.aspx?symbol=$1
cat $1quote.html | grep '' -B 1 | grep '[0-9].[0-9]' | awk -F ' - ' '{print "StockCode: " $1}'
cat $1quote.html | grep '>Last]' '{print "LastPrice: " $7}'
cat $1quote.html | grep '>Lot Size' -A 1 | grep '[0-9].[0-9]' | awk -F '[<|>]' '{print "LotSize: " $3}'
cat $1quote.html | grep '>Spread' -A 1 | grep '[0-9]/[0-9]' | awk -F '[<|>]' '{print "Spread: " $3}'
cat $1quote.html | grep '>P/E Ratio' -A 1 | grep '[0-9].[0-9]' | awk -F '[<|>]' '{print "PERatio: " $3}'
cat $1quote.html | grep '>EPS' -A 1 | grep '[0-9].[0-9]' | awk -F '[<|>]' '{print "EPS: " $3}'
cat $1quote.html | grep '>Last Update:<' -A 1 | grep '[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]' | awk -F '[<|>]' '{print "LastUpdateTime: " $3}'
rm -f $1quote.html