makind1 530 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/bin/rc
  2. owd=`{pwd}
  3. cd $1
  4. for (i in *){
  5. sed -n '
  6. /^.TH *[^ ]* */{
  7. s///
  8. s/ .*//
  9. h
  10. }
  11. /SH.*NAM/{
  12. N
  13. s/.*\n//
  14. :x
  15. N
  16. /\n.SH.*/{
  17. s///
  18. s/^/'$i' /
  19. s/\n/ /g
  20. s/ */ /g
  21. G
  22. s/([^ ]*)(.*)\n(.*)/\1(\3)\2/
  23. s/[A-Z]\)/)/
  24. p
  25. d
  26. }
  27. s/\n\.[^ ]* */ /
  28. bx
  29. }
  30. ' $i
  31. }
  32. cd $owd
  33. exit
  34. # add to shell script to get file references
  35. # in this case, pipe output thru uniq
  36. /^\.RF *[^ ]*/s//.F/
  37. /^\.FR(.* ).*/s//.F \1/
  38. /^\.F */{
  39. s//$i /
  40. s/\.[^ .]*//
  41. G
  42. s/([^ ]*)(.*)\n(.*)/\1(\3)\2/
  43. s/[A-Z+]\)/)/
  44. p
  45. }