Created
December 2, 2017 08:05
-
-
Save Iruyan-Zak/186ce5d5cf8164744721dbf2f9326ef1 to your computer and use it in GitHub Desktop.
12/02にシェル芸勉強会で発表した内容です。
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
echo -ne '🍣 sed 🍣 で始める簡単ループエンジン ' | sed -E ':b;p;s/(.)(.*)/\2\1/;bb'| xargs -i bash -c 'sleep 0.2 && echo -ne \\r{}' |
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
echo '初期条件' | sed -nE ':b; /終了条件|.{20}/b; p; s/$/更新式/; bb' |
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
echo _ _ | sed -nE ':b; p; s/(_*) (_*)/\2 \1\2/; bb' | sed 's/ .*//' | head -n20 | xargs -i sh -c 'echo {} | head -c-1 | wc -m' |
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
echo 1 | sed -nE ':b;/[01]{5}/b;p;s/^/1+/;s/$/@0@/;tadd1;:add1;s/([01]*)([01])(\+[01]*)([01])@/\1\3@\2\4/;s/@((.?)(.)|(.)(.?))(\3|\4)(.?)@/@\3\4@\2\5\7/;tadd1;s/([01]*)?\+/\1/;tadd2;:add2;s/1@1@/@1@0/;tadd2;s/0@1/@1/;s/@([01])?@/\1/;bb' | sed 's/$/_/;:b;s/^.//;/^[01]/!b;s/_/__/g;/^1/s/$/_/;bb' | xargs -i sh -c "echo {} | head -c-1 | wc -m" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment