Plan 9 from Bell Labs’s /usr/web/sources/plan9/rc/bin/thesaurus

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#!/bin/rc

hget 'http://thesaurus.reference.com/search?q='^$1 |
	htmlfmt -l 1000 |
	sed -n '/^Main Entry:/,/^Source/ {
		/^Source/ q
		/^[A-Z].*:/ {
			N
			s/\n/	/g
		}
		p
	}' | awk -F', ' '{
		if(length($0)<=70){
			print
			next
		}
		l = 0
		for(i = 1; i < NF; i++){
			printf "%s ", $i
			l += length($i)+1
			if(l > 70){
				printf "\n\t\t"
				l = 2*ENVIRON["tabstop"]
			}
		}
		if(l>0)
			printf "\n"
		next
	}'

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].