#!/bin/sh # Theresa L. Ford, 2/2010, www.Cattail.Nu # This is expecting an mytvrss.com xml like: # http://www.mytvrss.com/tvrss.xml?id=353762 # If it is not returning anything, there may be no events that match your date, try 1 as the second argument. # USAGE: rssmytvrss.sh [number of entries you want to see] [0 for today onwards, 1 for all] [url of rss feed] # max length of each block of output mymaxlength=250 if [ $# -ne 3 ] ; then echo "Usage: rssmytvrss.sh [number of entries to return] [0 for today onwards, 1 for all] [url]" exit 0 fi headarg="-$1" myall=$2 myurl=$3 mytoday=`date +%Y%m%d` curl --silent "$myurl" | \ grep -E '(title>|description>)' | \ sed -e 's/
//g' | \ sed 's/<\/p>/~/g' | \ sed -e 's/.*Air date: //' | \ sed 's/= mytoday+0 ) { print $3 "-" $1 "-" $2 ": " $4; } }' | \ head $headarg | awk -v mylength=$mymaxlength {'print substr($0,0,mylength)'} #EOF