Last active
August 29, 2015 14:09
-
-
Save Gabriel-p/681fce310855a05f0e4b to your computer and use it in GitHub Desktop.
Fill empty spaces in aligned columns file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment