Gentoo Archives: gentoo-user

From: gentuxx <gentuxx@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Bash + Awk + variable assignation.
Date: Tue, 20 Sep 2005 17:51:50
Message-Id: 43304A10.7020408@gmail.com
In Reply to: Re: [gentoo-user] Bash + Awk + variable assignation. by "A. Khattri"
1 -----BEGIN PGP SIGNED MESSAGE-----
2 Hash: SHA1
3
4 A. Khattri wrote:
5
6 >On Tue, 20 Sep 2005, Ow Mun Heng wrote:
7 >
8 >>Remember my script that sends out HTML emails? Well, that's done, but
9 >>it's in-efficient.
10 >>
11 >>The actual script that parses screen-scrapes. Initial script only went
12 >>to get the "Last Price" now, I would like to add the "Day Range"
13 >>
14 >>last_price()
15 >>{
16 >>value="$(lynx -dump "$url$symbol" | grep 'Last price:' | \
17 >> awk -F: 'NF > 1 && $(NF) != "N/A" { print $(NF) }' )"
18 >>}
19 >>
20 >>day_range()
21 >>{
22 >>day_range="$(lynx -dump "$url$symbol" | grep 'Low \& High:' | \
23 >> awk -F: 'NF > 1 && $(NF) != "N/A" { print $(NF) }' )"
24 >>}
25 >>
26 >>The above is in-efficient because I need to call the script to get the
27 >>page 2 times.
28 >
29 >
30 >Err... what were you saying about perl being hard...?
31 >
32 >(At some point, your shell script will become so convoluted that perl
33 >or python will look easy ;-)
34 >
35 >
36 Very true. I'm not familiar with python (although, I'd like to pick
37 it up), but perl is /perfect/ for screen scraping and text parsing.
38
39 - --
40 gentux
41 echo "hfouvyAdpy/ofu" | perl -pe 's/(.)/chr(ord($1)-1)/ge'
42
43 gentux's gpg fingerprint ==> 34CE 2E97 40C7 EF6E EC40 9795 2D81 924A
44 6996 0993
45 -----BEGIN PGP SIGNATURE-----
46 Version: GnuPG v1.4.1 (GNU/Linux)
47
48 iD8DBQFDMEoQLYGSSmmWCZMRAjBKAJ41tzDIkLvHL6z0EHtLSstdNaQWswCgxV0P
49 P7K37q6Exf0oMjLlI/Unng8=
50 =1cXq
51 -----END PGP SIGNATURE-----
52
53 --
54 gentoo-user@g.o mailing list