Suppose I have these two files:
1.
Locus_1 univ
Locus_2 anc
Locus_3 cat
2.
university GO:000001
impromptu GO:000002
advanced GO:000003
inheritance GO:000004
I want to do a grep -f of the $2 of file #1 on file #2, but I also want to retrieve the lines of the first file and the whole line of file #2 that match $2 of file #1.
Basically, I want my output to be like this
Locus_1 univ university GO:000001
Locus_2 anc advanced GO:000003
How can I do this?
I thought I could parse the first file line by line with a for
cycle and then store the line in a variable, but I was not able to succeed.
I use a Cygwin shell for Windows.
awk
?sed
etc.