View Single Post
Old 09-03-2018, 06:42 AM   #59
PoP
 curly᷂͓̫̙᷊̥̮̾ͯͤͭͬͦͨ ʎʌɹnɔ
PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.
 
PoP's Avatar
 
Posts: 3,018
Karma: 50506927
Join Date: Dec 2010
Location: ♁ ᴺ₄₅°₃₀' ᵂ₇₃°₃₇' ±₆₀"
Device: K3₃.₄.₃ PW3&4₅.₁₃.₃
Quote:
Originally Posted by NiLuJe View Post
@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
PoP is offline   Reply With Quote