See page 121 of Kernighan & Pike "The UNIX Programming Environment" for an awk version of "double". In my edition of the book there is an error in the program -- near the end it reads: printf "double %s, ... if (NF > 0) # <= DELETE ONLY THIS LINE lastword = NF }' $*