ap 645 B

123456789101112131415161718192021222324252627282930313233343536
  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 '/<h1>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/\.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,/^AP Top News$/d
  32. /^\* __$/,$d
  33. /^Subscribe to Newsday home delivery/,$d
  34. '