ap 675 B

123456789101112131415161718192021222324252627282930313233343536373839
  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 | tee /tmp/ap.tmp |
  9. htmlfmt -a -w 100 |
  10. sed -n '
  11. 1,/On Wall Street/d
  12. /AP News Wire/,$d
  13. /^• / {
  14. N
  15. s/^• / /g
  16. s/\n/ /g
  17. s/\[\/news\/nationworld\/wire\//|/
  18. s/,[0-9]+,[0-9]+\.story.*$//
  19. p
  20. }' |
  21. awk -F '|' '
  22. {
  23. s = "";
  24. for (i = 1; i < NF; i++)
  25. s = s " " $i;
  26. printf("ap %-40s # %s\n", $NF, s);
  27. }'
  28. if not
  29. hget $wire/^$1^.story |
  30. htmlfmt |
  31. sed '
  32. s/\| Article licensing.*$//
  33. /^Copyright ©/p
  34. /^Copyright ©/,$d
  35. 1,/^Top Stories$/d
  36. /^$/,/^$/d
  37. '