Quote:
Originally Posted by NiLuJe
@PoP: I could use a cheat-sheet of which number gets replaced by which pipe, but it's crazy enough that I like it  .
EDIT: I *think* busybox ash supports the slice substring operation (${var:}), which might allow you to fake an array (i.e., BLAH="ABCD"; IDX="1"; echo ${BLAH:$IDX:1} => B), and a such fake LUTs for the replacements, which might be a tad faster than calling sed like crazy, since the substring operation should be builtin (... and hopefully faster than sed)  .
|
(Note to myself: code in C next time).
I tried ${var:} initially, it was giving me syntax errors (unless it was some other poorly coded shell expansions). In fact my first version looked much simpler. I thought « let me use a shell script, it will be an easy POC) » only to find out that UTF-8 multibytes were totally messing column alignments in string manipulations

and from then on I had to go deeper and messier into the script to the point that cheat sheets are required:
╔═╦═╗ 12324
║─║─║ 56565
╠═╬═╣ 72829
║─║─║ 56565
╚═╩═╝ a2b2c