Last active
April 23, 2020 05:11
-
-
Save orirawlings/5d8971d17250bbfcc63fd3c0d1f49df6 to your computer and use it in GitHub Desktop.
An awk program to tile ascii art up to a given column width, endlessly.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
l[NR] = $0 | |
if (length($0) > max) { max = length($0) } | |
} | |
END { | |
while (1) { | |
for (i=1;i<=NR;i++) { | |
for (j=1;j<=width/max;j++) { | |
printf("%-"max"s", l[i]) | |
} | |
print substr(l[i], 1, width % max) | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat unicorn | awk -v width=150 -f paper.awk | head -n 50 | |
////))))))\ ////))))))\ | |
/////))))))))))======= /////))))))))))======= | |
/////// )) /////// )) | |
/////// \_ *) ) /////// \_ *) ) | |
________________////// / \ / ________________////// / \ / ____________ | |
////)) \> | | | ////)) \> | | | ////)) | |
///////// \ \ |_o ///////// \ \ |_o ///////// | |
//////////// ) _. | //////////// ) _. | //////////// | |
/////// \ \ \ | /////// \ \ \ | /////// \ \ | |
/// \ \ \ \/\______. /// \ \ \ \/\______. /// \ \ | |
/\ )________ \_ \____.__ \ /\ )________ \_ \____.__ \ /\ )_____ | |
_/ \ / '--------- \________ \ \ \ _/ \ / '--------- \________ \ \ \ _/ \ / | |
/ _/ / / / / \ \ / _/ / / / / \ \ / _/ / / | |
/ / \ < / / > ) / / \ < / / > ) / / \ < | |
( < \ \ _// \/ ( < \ \ _// \/ ( < \ \ | |
\ \ \ \ |_/ \ \ \ \ |_/ \ \ \ \ | |
\\_ \\_ \\_ \\_ \\_ \\_ | |
|_\ |_\ |_\ |_\ |_\ |_\ | |
////))))))\ ////))))))\ | |
/////))))))))))======= /////))))))))))======= | |
/////// )) /////// )) | |
/////// \_ *) ) /////// \_ *) ) | |
________________////// / \ / ________________////// / \ / ____________ | |
////)) \> | | | ////)) \> | | | ////)) | |
///////// \ \ |_o ///////// \ \ |_o ///////// | |
//////////// ) _. | //////////// ) _. | //////////// | |
/////// \ \ \ | /////// \ \ \ | /////// \ \ | |
/// \ \ \ \/\______. /// \ \ \ \/\______. /// \ \ | |
/\ )________ \_ \____.__ \ /\ )________ \_ \____.__ \ /\ )_____ | |
_/ \ / '--------- \________ \ \ \ _/ \ / '--------- \________ \ \ \ _/ \ / | |
/ _/ / / / / \ \ / _/ / / / / \ \ / _/ / / | |
/ / \ < / / > ) / / \ < / / > ) / / \ < | |
( < \ \ _// \/ ( < \ \ _// \/ ( < \ \ | |
\ \ \ \ |_/ \ \ \ \ |_/ \ \ \ \ | |
\\_ \\_ \\_ \\_ \\_ \\_ | |
|_\ |_\ |_\ |_\ |_\ |_\ | |
////))))))\ ////))))))\ | |
/////))))))))))======= /////))))))))))======= | |
/////// )) /////// )) | |
/////// \_ *) ) /////// \_ *) ) | |
________________////// / \ / ________________////// / \ / ____________ | |
////)) \> | | | ////)) \> | | | ////)) | |
///////// \ \ |_o ///////// \ \ |_o ///////// | |
//////////// ) _. | //////////// ) _. | //////////// | |
/////// \ \ \ | /////// \ \ \ | /////// \ \ | |
/// \ \ \ \/\______. /// \ \ \ \/\______. /// \ \ | |
/\ )________ \_ \____.__ \ /\ )________ \_ \____.__ \ /\ )_____ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment