I have two files like this:
Animal Food
cat fish
Dog meet
cow grass
second file:
Animal Food Price
cat fish 45
Dog meet 47
Got grass 74
I just want to compare these two files based on the first and second column as like this:
Animal Food Price
cat fish 45
Dog meet 47
Usually, I will perform this with the JOIN function but in this case, sorting is not possible. I need results exactly the same order as on file 1
Then I tried with AWK as like this:
awk 'NR==FNR {$1 = $2; next} {print}' file1 file2
But it is producing some duplicate results and different order.