Hi I have one AWK Command which is combine two files have same key.
awk -v OFS='\t' '
NR==1 { print $0, "Column4", "Column5"; next }
NR==FNR { a[$1]=$0; next}
$1 in a { print a[$1], $2, $3 }
' $1 $2 > $3
This is return only one key from each files. For example as below,
File 1
Key Column1 Column2 Column3
Test1 500 400 200
Test1 499 400 200
Test1 499 399 200
Test1 498 100 100
Test2 600 200 150
Test2 600 199 150
Test2 599 199 100
File 2
Test1 Good Good
Test2 Good Good
Then Results will be
Key Column1 Column2 Column3 Column4 Column5
Test1 500 400 200 Good Good
Test2 600 200 150 Good Good
but I want to make all rows have combined like below.
Key Column1 Column2 Column3 Column4 Column5
Test1 500 400 200 Good Good
Test1 499 400 200 Good Good
Test1 499 399 200 Good Good
Test1 498 100 100 Good Good
Test2 600 200 150 Good Good
Test2 600 199 150 Good Good
Test2 599 199 100 Good Good
Anyone has idea simply to change logic using AWK. Thank you!C
; nextin thatNR==FNRblock.