perl -pi -e 'substr($_,589,35) =~ s/(0*)(\w+)*/$2($?{ ' ' x length($1) })/ if /^(.{589})(0{1,34})/' file.txt