thesaurus 422 B

1234567891011121314151617181920212223242526272829
  1. #!/bin/rc
  2. hget 'http://thesaurus.reference.com/search?q='^$1 |
  3. htmlfmt -l 1000 |
  4. sed -n '/^Main Entry:/,/^Source/ {
  5. /^Source/ q
  6. /^[A-Z].*:/ {
  7. N
  8. s/\n/ /g
  9. }
  10. p
  11. }' | awk -F', ' '{
  12. if(length($0)<=70){
  13. print
  14. next
  15. }
  16. l = 0
  17. for(i = 1; i < NF; i++){
  18. printf "%s ", $i
  19. l += length($i)+1
  20. if(l > 70){
  21. printf "\n\t\t"
  22. l = 2*ENVIRON["tabstop"]
  23. }
  24. }
  25. if(l>0)
  26. printf "\n"
  27. next
  28. }'