Created
September 25, 2019 05:38
-
-
Save roblogic/59b714eea1f170da04eabb2766ef5056 to your computer and use it in GitHub Desktop.
run-length encoding in zsh, https://codegolf.stackexchange.com/a/192869/15940
This file contains hidden or 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
| while read w; do | |
| i= | |
| for ((n=1;i++<#w;n++))[[ $w[i] != $w[i+1] ]]&&printf $n$w[i]&&n=0 | |
| echo | |
| done < <(echo "heeeello\nwoooorld") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment