I have a large file which have some corrupt lines like this
0.6 8 379699 730 0.999769 0.802075 0.912155
0.6 8 379699 731 0.999698 0.8181070.8 8 377999 0 0.674844
0.765493 0.900248
0.8 8 377999 1 0.835223 0.913123 0.883744
0.8 8 377999 1 0.816537 1 0.852433
The file ideally should look like
0.6 8 379699 730 0.999769 0.802075 0.912155
0.6 8 379699 731 0.999698 0.818107 nan
0.8 8 377999 0 0.674844 0.765493 0.900248
0.8 8 377999 1 0.835223 0.913123 0.883744
0.8 8 377999 1 0.816537 1 0.852433
I thought that a simple (lazy) way to fix this problem might be to just delete any lines which don't have 7 columns. Can this be done? I was looking into using awk -F' ' '
to obtain the number of columns in each line. is there a better way?
:%s/\d\zs\d\.\d/\r&/