0

I want to do the opposite of what was done here: Rows to column conversion of file

File1

MT
MT
MT
GROUP1
GROUP1
GROUP2

File2

FALSE FALSE FALSE FALSE FALSE FALSE
FALSE FALSE FALSE FALSE FALSE FALSE
FALSE FALSE FALSE FALSE FALSE FALSE

Outputfile

MT MT MT GROUP1 GROUP1 GROUP2 
FALSE FALSE FALSE FALSE FALSE FALSE 
FALSE FALSE FALSE FALSE FALSE FALSE 
FALSE FALSE FALSE FALSE FALSE FALSE 
Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255
Age87
  • 559

1 Answers1

1

Here's one way, using Awk:

awk '{$1=$1} 1' RS= File1 RS='\n' File2
MT MT MT GROUP1 GROUP1 GROUP2
FALSE FALSE FALSE FALSE FALSE FALSE
FALSE FALSE FALSE FALSE FALSE FALSE
FALSE FALSE FALSE FALSE FALSE FALSE
  • read File1 in paragraph mode by unsetting the record separator
  • then reset the default record separator before reading File2
  • action $1=$1 causes both files to be re-written with the default output field separator
Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255
steeldriver
  • 81,074