Question

For example I have these 2 lists:

List A

Dog           Tamal301*
Iguana        Tamal345
Cat           Tamal405
Snake         Tamal408*
Cocodrile     Tamal420
Bird          Tamal467*
Parrot        Tamal578*

List B

Tamal301*     Orchid
Tamal320      Daisy
Tamal408*     Poinsettia
Tamal467*     Tulip
Tamal490      Rose
Tamal578*     Chrysanthemums

(the * is just to emphazise that there are coincidences, it shouldn't be there)

I want to merge together list A and B, with only the matches.

Like this:

Dog           Tamal301       Orchid
Snake         Tamal408       Poinsettia
Bird          Tamal467       Tulip
Parrot        Tamal578       Chrysanthemums

I have a method to do it, but it is stupid, greps and for loops.

So I want to know if there is a better way to do it.

Thanks guys =D

Was it helpful?

Solution

Check the manual for the join command: man 1 join

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top