ap 733 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/rc
  2. #
  3. # get AP news headline list or the given story
  4. #
  5. wire='http://www.newsday.com/news/nationworld/wire'
  6. if ( ~ $#* 0 )
  7. hget $wire | #tee /tmp/ap.$pid |
  8. sed -n '/AP Top News/,/AP News Wire/p' |
  9. htmlfmt -a -w 100 |
  10. sed -n '
  11. /^• / {
  12. N
  13. s/^• / /g
  14. s/\n/ /g
  15. s/\[\/news\/nationworld\/wire\//|/
  16. s/sns-ap-//
  17. s/,[0-9]+,[0-9]+\.story.*$//
  18. p
  19. }' |
  20. awk -F '|' '
  21. {
  22. s = "";
  23. for (i = 1; i < NF; i++)
  24. s = s " " $i;
  25. printf("ap %-40s # %s\n", $NF, s);
  26. }'
  27. if not
  28. hget $wire/sns-ap-^$1^.story |
  29. htmlfmt |
  30. sed '
  31. 1,/^=======$/d
  32. /^Email this story$/d
  33. /^Printer friendly format/d
  34. /^\* __$/,$d
  35. /^Subscribe to Newsday home delivery/,$d
  36. /^SPONSORED LINKS$/,$d
  37. '