sounds to me like a [too] big thing to code
a tokenizer to internal codes then to output format
On Sun, Mar 14, 2021 at 3:48 PM Peng Yu <pengyu.ut@gmail.com> wrote:
> On 3/14/21, Alex fxmbsw7 Ratchev <fxmbsw7@gmail.com> wrote:
> > about self coding a solution, i started in gawk, but question: do you
> want
> > \t and \n be shortened or printed
>
> I am not sure. That is where the ambiguity comes from. It will depend
> on the real usage. If the string's main purpose is to show tab and
> newline explicitly, then they should be encoded in an escaped form,
> but if the main purpose is not to show them, then they should not be
> escaped. But this is context-dependent. So it may need some trial and
> error to be sure which choice is the best. Or it may need to
> empirically determine which is the case based on the content of the
> whole string.
>
> > and only \34 codes be placed in $' .. '
> > otherwise " " otherwise no quotes
>
> It is more than these three cases. '' is also useful in certain cases.
> Also, sometimes, splitting the whole string into segments and use a
> different style for each segment may also improve readability.
>
> --
> Regards,
> Peng
>