Text de-justification to get correct substring
Asked Answered
A

1

0

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?

enter image description here enter image description here

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

Airplane answered 11/4, 2014 at 12:51 Comment(3)
I voted to close because as it stands, you've left too much guesswork. Perhaps if you actually showed a few lines of your input and what you've tried already...Corettacorette
You are comparing GNU fmt to OS X's BSD fmt. They are not the samePorcelain
is there a version for windows that you know of? can't seem to find it, thx for the infoAirplane
T
0

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/

Tryma answered 11/4, 2014 at 13:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.