On 30 June 2011 10:59, Jim Cheetham <[email protected]> wrote:
> Here's the test :-
>
> for i in abcdefghijklmnopqrstu \
>             abcdefghijklmnopqrstuv \
>             abcdefghijklmnopqrstuvw \
>             abcdefghijklmnopqrstuvwx \
>             abcdefghijklmnopqrstuvwxy \
>             abcdefghijklmnopqrstuvwxyz
> do
>   printf "$i -> "
>   echo $i | \
>         sed -r 's/^(.{5})(.*)/\2\1/; s/(.{4})/\1Z/g;
> s/(.{1,4})Z(.{1,4})Z?$/\1\2/; s/(.*)(.{5})$/\2\1/'
> done
>
> abcdefghijklmnopqrstu -> abcdefghiZjklmZnopqZrstuZ
> abcdefghijklmnopqrstuv -> abcdefghiZjklmZnopqZrstuZv
> abcdefghijklmnopqrstuvw -> abcdefghiZjklmZnopqZrstuZvw
> abcdefghijklmnopqrstuvwx -> abcdefghiZjklmZnopqZrstuZvwx
> abcdefghijklmnopqrstuvwxy -> abcdefghiZjklmZnopqZrstuZvwxyZ
> abcdefghijklmnopqrstuvwxyz -> abcdefghiZjklmZnopqZrstuZvwxyZz
>
> -jim

Found an edge case:  abcd -> abcdZ

https://gist.github.com/1057759

-- 
Kent

perl -e  "print substr( \"edrgmaM  SPA NOcomil.ic\\@tfrken\", \$_ * 3,
3 ) for ( 9,8,0,7,1,6,5,4,3,2 );"

http://kent-fredric.fox.geek.nz

_______________________________________________
Linux-users mailing list
[email protected]
http://lists.canterbury.ac.nz/mailman/listinfo/linux-users

Reply via email to