#! /usr/bin/gawk -f # Reads a list of words from stdin. For each word, writes # to stdout all its proper substrings. /./ { n = length($0) for(i=1;i<=n;i++) for(m=1;m<=n-i+1;m++) { if (m!=n) print substr($0,i,m) } next }