Skip to content

Obfuscated awk

This started as a pastime during a rainy afternoon, and ended up being included by Arnold Robbins in the GNU awk manual:

Copy and distribution of the code published in this page, with or without
modification, are permitted in any medium without royalty provided the copyright
notice (see bottom of page) and this notice are preserved.
awk 'BEGIN{O="~"~"~";o="=="=="==";o+=+o;x=O""O;while(X++<=x+o+o)c=c"%c";
printf c,(x-O)*(x-O),x*(x-o)-o,x*(x-O)+x-O-o,+x*(x-O)-x+o,X*(o*o+O)+x-O,

To see what it does, just run it (hint: it's not different from other pieces of obfuscated code published here).