----------------------------------------------------------------------- BEGIN { FS = "[^a-z]+" } { for (i=1; i <= NF; i++) for (j=1; j <= length($i)-2; j++) { s = substr($i,j,3); count[s]++; word[s] = i$ } } END { for (s in count) if (count[s]==1) print word[s]) ----------------------------------------------------------------------- { f = "temp" hist[++n] = "last = " $0 print "BEGIN {" >f for (i=1; i <= n; i++) print hist[i] >f if ($0 !~/\=/) print "print \" \" last" >f print "}" >f close(f) if (system("awk -f " f)) { print "error"; n--} } ----------------------------------------------------------------------- awk ' # acomp foo: make foo.x from foo { gsub(/{/, "{ xyzzy ") while (sub(/ xyzzy /, " xyzzy[" ++bcnt "]++; ")) ; print } END { print "END { for (i = 1; i <= " bcnt "; i++) " \ "print xyzzy[i] > \"" ARGV[1] ".d\"}"} ' $1 > $1.x ----------------------------------------------------------------------- awk ' # aprint foo: print data from foo.d with program in foo BEGIN { while (getline < ARGV[1] ".d") > 0) count [++i] = 0+$1 } { gsub(/{/, " xyzzy ") while (sub(/ xyzzy /, "{ <<<" count[++bcnt] "... ")) ' print } ' $1 -----------------------------------------------------------------------