0
I want to replace leading tabs and spaces with something like <TAB>
and <SPACE>
respectively.
But I couldn't figure out how to do it in a single pass of sed
because tabs and spaces in the original file can be intermixed, so simply doing one replacement and than another doesn't work.
Input example (tabs shown as ^):
^^line with tabs
line with spaces
^ ^intermixed
Desired output:
<TAB><TAB>line with tabs
<SPACE><SPACE>line with spaces
<TAB><SPACE><TAB>intermixed
This is a really elegant solution. – zx485 – 2019-02-13T01:26:20.393
That is very readable solution! I guess there is no point using
sed
whenawk
solution looks simpler. Thank you! – Amomum – 2019-02-13T20:21:20.770