ap 734 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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 '/LAST 7 DAYS/,/end last 7 days/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. s/\| Article licensing.*$//
  32. /^Copyright ©/p
  33. /^Copyright ©/,$d
  34. /^Subscribe to Newsday/d
  35. 1,/^Top Stories$/d
  36. s/[ ]*$//
  37. s/^\* __$//
  38. ' #| fmt