Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shortest possible awk program ? #1

Open
mogando668 opened this issue Jul 25, 2021 · 1 comment
Open

shortest possible awk program ? #1

mogando668 opened this issue Jul 25, 2021 · 1 comment

Comments

@mogando668
Copy link

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 _^__[\$_]++

@rethab
Copy link
Owner

rethab commented Jul 26, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants