newspaper

Is it going to rain today? Has anyone commented on my blog? Do I need to fill up my car before gas prices skyrocket? And how about those stocks I decided to watch?

If you are like me, it's easy to kill an hour or two at the computer. Sad but true. Worst is that I almost always get distracted and forget to look up all the above questions. Along comes my favorite script: newspaper.

$ newspaper
Mon Oct 31 22:44:17 UTC 2005
Nymex Crude Oil is currently selling at:
     $ 59.79
WEATHER REPORT:

   UV Index:   0 Low
   Wind:       From NNW at 9 mph
   Humidity:   61%
   Pressure:   30.30 in. [up_pressure.gif]
   Dew Point:  41°F
   Visibility: 10.0 miles
   Precip:   20%
   Precip:   10%
   Precip:   0%
   Currently:
      54°
   sky: fair (night)
   Fair
   High: 64°
   Low: 45°


You are watching 2325 shares of ABMC stock, bought at $ 0.86
   American Bio Medica Corp. (ABMC) At 3:50PM ET: 1.07   Down  0.01

Current Xanga responces
3 comments 
add comments 
1 comment 
add comments 
2 comments 




Look neat? I think so. Want to see mechanics of the script? SURE!

#! /bin/sh

# (c) 2005 Nic Reveles
# This script parses web pages to provide all the possible data you might want
# requires lynx to run.  Consider creating a more natural 'date'.

date

echo "Nymex Crude Oil is currently selling at:"

lynx -dump http://www.bloomberg.com/energy > $HOME/.newspaper
TMP=`cat $HOME/.newspaper | grep "Nymex Crude" | cut -d " " -f8`
echo "     $ $TMP"

lynx -dump http://weather.com/weather/local/75077 > $HOME/.newspaper

echo WEATHER REPORT:
echo ""

cat $HOME/.newspaper | grep "UV Index:"
cat $HOME/.newspaper | grep "Wind:"
cat $HOME/.newspaper | grep "Humidity:"
cat $HOME/.newspaper | grep "Pressure:"
cat $HOME/.newspaper | grep "Dew Point:"
cat $HOME/.newspaper | grep "Visibility:"

# 3 precips...
cat $HOME/.newspaper | grep "Precip:"

lynx -dump http://weather.yahoo.com/forecast/USTX0761.html > $HOME/.newspaper
cat $HOME/.newspaper | grep -A 6 "Currently:"
cat $HOME/.newspaper | grep -A 2 "Today:"

echo ""

lynx -dump http://finance.yahoo.com/q/bc?s=ABMC > $HOME/.newspaper
echo "You are watching 2325 shares of ABMC stock, bought at $ 0.86"
cat $HOME/.newspaper | grep "American Bio Medica Corp"

echo ""

lynx -dump http://www.xanga.com/home.aspx?user=YOUR_USER_NAME > $HOME/.newspaper
echo "Current Xanga responses"
cat $HOME/.newspaper | grep "email it" | cut -d "-" -f3 | cut -d "]" -f2

echo ""

rm $HOME/.newspaper

(c) 2005 Nic Reveles
Updated