I have two files with multiple rows. 1st file have 2 colums and second file have more than 2000 colums. Example data sets are:
Example File_1
car Maruti
car TATA
car Hyundai
car Jaguar
Jeep Mahindra
Example File_2
car A B C D E F G
Jeep X Y Z W Q W K
I have tried this
awk '{a[$1]=a[$1]" "$0} ++n[$1]==2{print a[$1]}' File_2 File_1
Tho output of this command print the data only single time and not in perfect order. I got the following result:
car A B C D E F G car Maruti
Jeep X Y Z W Q W K Jeep Mahindra
Expected Output on the basis of 1st file is:
car Maruti car A B C D E F G
car TATA car A B C D E F G
car Hyundai car A B C D E F G
car Jauar car A B C D E F G
Jeep Mahindra Jeep X Y Z W Q W K