Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Using curl instead of lynx...' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Using curl instead of lynx...
Authored by: wallybear on Jul 11, '05 04:21:01AM
Here is a possible quick and dirty variant that doesn't need to install lynx. Yes, it could be better done, by the way it works:

#!/bin/tcsh -f 

echo -n "$2 $1 = $3 " 
curl -s 'http://finance.yahoo.com/currency/convert?amt='$1'&from='$2'&to='$3'&submit=Convert' | tr "^" "_" | sed 's/yfnc_tablehead1/^/g' | tr "^" "\n" | grep $2$3 | sed 's//^/g' | tr "^ " "\t_" | awk '{ print $6 }' | sed 's/]*>//g'  

exit 0
(there are no line breaks from curl to ..//g')

As sed does not allow to use \n in the substitution string I had to use a workaround with tr.


[ Reply to This | # ]