ap 651 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/bin/rc
  2. #
  3. # get AP news headline list or the given story
  4. #
  5. tmp=/tmp/tmp.$pid
  6. wire='http://www.newsday.com/news/nationworld/wire'
  7. if ( ~ $#* 0 )
  8. hget $wire |
  9. htmlfmt -a -w 100 |
  10. sed -n '
  11. /AP News Wire/,$d
  12. /reddot\.gif/ {
  13. N
  14. s/\n/ /g
  15. s/\[image [^\]]*] *//
  16. s/\[\/news\/nationworld\/wire\//|/
  17. s/,[0-9]+,[0-9]+\.story.*$//
  18. p
  19. }' |
  20. awk -F '|' '{
  21. s = "";
  22. for (i = 2; i <= NF; i++)
  23. s = s " " $i;
  24. printf("%-40s %s\n", s, $1);
  25. }'
  26. if not
  27. hget $wire/^$1^.story |
  28. htmlfmt |
  29. sed '
  30. 1,/^AP News Alert/d
  31. s/.*(Copyright .* The Associated Press).*$/\1/p
  32. /Copyright .* The Associated Press/,$d
  33. '