awk-scripts icon indicating copy to clipboard operation
awk-scripts copied to clipboard

shortest possible awk program ?

Open mogando668 opened this issue 4 years ago • 1 comments

the absolute shortest program i can think of is

awk ''

that depends on whether blocking everything through the inputs and pipe counts as "doing stuff"" or not. to make it print without any formatting*

awk 1

it's a *caveat cuz it still will pad in the ORS regardless of input, so if the input lacks a trailing new line, this would inadvertently added extra stuff in.

if you wanna make it weirdo and fun looking without typing numbers or risking exposing exclamation mark (!) in console, then do

awk _^_

that's just zero to zero-th power, 0**0=1, so it's identical to the previous program.

and if you wanna do row-de-duping, but too lazy to do proper shell-quoting, then it's

awk _^__[\$_]++

mogando668 avatar Jul 25 '21 09:07 mogando668

Thanks for this @mogando668. It is beautiful to see people share the enthusiasm about obscure and funny programs 😃

rethab avatar Jul 26 '21 05:07 rethab