awk / sed / etc. concatenating colums in one file

I wonder what is a simpler way to do this:

awk 'NR > 1 {print $1"t"$2"t"$3"t"$4"t"$5"t"$6"t"$7"t"$8"t"$9$10$11$12$13$14$15$16}'  file.in > file.out

which is simply speaking ” concatenate columns 9 to 16 by removing tabs in-between”

Merged columns 9-16 become “Notes” so may include whitespaces.

As of today there are 16 columns but this may evolve in more/less if required. Eventually column 9 (concatenated 9-16) becomes “notes” field.

Cheers,
Xi

Answer

paste <(cut -f 1-8 file) <(cut -f9- file | tr -d 't')

Leave a Reply

Your email address will not be published. Required fields are marked *