#!/bin/sh
OUT="/tmp/~ebinfo"
rm -f $OUT > /dev/null 2>&1

wget -q -O $OUT "http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=$1"

#set -x
if [ -s $OUT ] ; then
# search description
   sed -n '/Begin Description/,/End Description/p' $OUT | \
# change to unix format
   tr -d "\r" | \
# convert to text
   html2txt.pl | \
# filter header
#      sed '/<head>/,/<\/head>/d' | \
# insert linebreaks
#      sed 's/<br>/\|/g' | tr "|" "\n"
# delete html tags
#      sed -e :a -e 's/<[^>]*>//g;/</N;//ba' | \
# delete &nbsp;
#      sed '/&nbsp;/d' | \
# delete duplicate blank lines
   sed '/./,/^$/!d'
fi
