Gabriel-p
11/19/2014 - 5:31 PM

Fill empty spaces in aligned columns file

Fill empty spaces in aligned columns file

# See:
# http://unix.stackexchange.com/questions/164207/insert-missing-string-in-multiple-ordered-columns
#
# The string of numbers after 'FIELDWIDTHS' indicate the end position of each column in the file

# The column numbers should be counted *starting from 0*.

gawk -vFIELDWIDTHS="4 7 4 6 8 8 6 8 8 8 7 5 4" -vOFS= '{for (i=1;i<=NF;i++) sub("  $","--",$i);}1' file.dat > out.dat