Artificial intelligent assistant

unicode safe alternative for fold I'm using `fold -w 3` to split a line into multiple 3 chars long, however with the GNU implementation, it does not work for text with multi-byte characters it seems. How can I achieve the above with `sed`? I've come up with `sed -r 's/^(.{0,3})(.*)/\1\n\2/g'` however this only does a single replacement: echo "111222333444555666" | sed -r 's/^(.{0,3})(.*)/\1\n\2/g' 111 222333444555666 * * * Additional examples: echo "ĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄ" | sed -r 's/^(.{0,3})(.*)/\1\n\2/g' ĄĄĄ ĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄ And `fold` with it's corrupting behavior: echo "ĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄ" | fold -w 3 Ą Ą Ą Ą Ą

Short **`grep`** approach:


echo "ĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄ" | grep -Eo '.{1,3}'
ĄĄĄ
ĄĄĄ
ĄĄĄ
ĄĄĄ
ĄĄĄ
ĄĄĄ
ĄĄĄ
ĄĄ


* * *

To retain only 3-char sequences: `... | grep -Eo '.{3}'`

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy b074c0b257c7b6a1a006eb8a5e888326