I have a problem with file which was reformated during some operation and looks like this:
Code:
18450 0600060009 25 0 768188519 768188519 0030020124 000 000 10
77019 73587 25 0 73165 730740506 0160100051 029 000
74049 25 0 73950 1040030047 030 000
14048 14048 25 0 11833 11833 022 000
18450 0600060027 25 0 709948778 709948778 0010030064 000 000 10
73330 25 0 0050312875 77020 000 000
18450 0600040020 25 0 703820853 703820853 0030020125 000 000 10
And I need it to look like this
Code:
18450 0600060009 25 0 768188519 768188519 0030020124 000 000 10
77019 73587 25 0 73165 730740506 0160100051 029 000
74049 25 0 73950 1040030047 030 000
14048 14048 25 0 11833 11833 022 000
18450 0600060027 25 0 709948778 709948778 0010030064 000 000 10
73330 25 0 0050312875 77020 000 000
18450 0600040020 25 0 703820853 703820853 0030020125 000 000 10
What happened was that column B has shifted 5 places to the right.
I've tried to solve it with a simple
Code:
while read do printf
but the problem is how to read empty spaces into the variable. I've tried with perl and substr, but it doesn't really work as it shoul. It looks like sed would be a perfect tool for that, but I just don't know how to do it as any of column where number of digits is greater then 3 can be empty. Any help appreciated.