Hi,
Using this trivial code, I am trying to insert/paste the single column data of a file into the second column (field 2) of a multi-column text file.
awk 'FNR==NR {a[FNR]=$0; next} {$1=$1 OFS a[FNR]}1' single-column-file multi-column-file
Lets consider the single-column-file as 'f2' and multi-column file as 'f1'.
I know that the array a[FNR] is having the single column data of file f2 and I am just replacing $1 of file f1 with the first field of f1 + output-field-separator + a[FNR]. My question is, how does the other columns (after the 1st column of f1) get appended?