in reply to Reformat file with empty spaces

poj has given you a solution that probably solves the misalignment problem, but pay attention that it appears that the lines where the second field is shifted five spaces to the right also seem to have been truncated on their right end. It may be a wrong impression, or perhaps there is no such problem because it is only due to the fact that you did not show the entire lines, but I thought it was worth pointing out this possible issue.

Replies are listed 'Best First'.
Re^2: Reformat file with empty spaces
by Anonymous Monk on Jan 12, 2018 at 14:28 UTC
    Hej Laurent, that was really observant, thanks for that. Basically (as a Perl beginner) I just needed a push and Poj's substr helped me a lot. Of course, I have changed his original script a bit so it suits my needs (including taking care of other columns), but idea was there to help me. Thank you very much also for bringing this point into daylight.