-->

Text de-justification to get correct substring

2019-08-31 12:24发布

问题:

I have a text file which is made up with justify (all tabs aligned - different size).
Therefore I can't get the desired value at a certain column (substring).
Since this is a migration I can't change the format of the file.

How can I "de-justify" the text to spaces while preserving the spacing length, any scripts out there?

I need the upper value. replacing \t with a fixed value doesn't help.

*EDIT: files seems to be formatted with fmt

*EDIT2: Solution found it seems; when I use fmt on windows (coreutils) it stays the same.
However on my mac I get the desired result (maybe something in the win command not setup right).

fmt original_file >> new.txt

Grts

回答1:

There's probably lots of other ways to do this, but sublime text has built in tab to space conversion.

http://css-tricks.com/changing-spaces-tabs-sublime-text/