#! /usr/bin/gawk -f # Last edited on 1999-11-30 19:22:42 by stolfi # Reads a stream of words, deletes all letters except the "circles" [aoy]. # Non-contigous [aoy] letters are kept separated by "-". # Words without any [aoy] letters are mapped to "-". /^ *$/{next;} /./{ gsub(/^[q]/, "", $0); # Map all non-empty, non-[aoy] strings to "-": gsub(/[^aoy][^aoy]*/, "-", $0); # Delete any prefixed or suffixed "-"s: gsub(/^[-][-]*/, "", $0); gsub(/[-][-]*$/, "", $0); # Words without any "[aoy]" become "-": gsub(/^$/, "-", $0); print $0; }