Created
December 8, 2014 01:10
-
-
Save mikkun/14c17ce199fa7504985a to your computer and use it in GitHub Desktop.
CodeIQ q1169『Restricted Base32』( http://bit.ly/1xiHTFC )解答例
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
#!/bin/bash | |
cat - | | |
tr a-z A-Z | | |
tr -cd A-Z2-7 | | |
tr A-Z2-7 0-9A-V | | |
fold -w1 | | |
sed \$s/$/\\\n/ | | |
while read _32; do echo $((32#$_32)); done | | |
while read _10; do echo obase=2\;$_10 | bc; done | | |
sed s/^/0000/g | | |
sed s/^.*\\\(.....\\\)$/\\\1/g | | |
tr -d \\n | | |
fold -w8 | | |
grep -v ^0\\\{1,7\\\}$ | | |
while read _2; do printf \\x$(echo obase=16\;$((2#$_2)) | bc); done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment