Reputation: 125
I am new to linux, and got this elementary question,,,
I would like to extract rows from a text file-A BASED on another text file-B containing the values of gene name (ABD, GHE)
so the output would be
chr gene start stop pval
2 ABD 5667 5789 0.03
5 GHE 4556 4784 0.34
file A
chr gene start stop pval
1 xic 455 467 0.005
2 ABD 5667 5789 0.03
5 GHE 4556 4784 0.34
file B
ABD
GHE
Thanks M
Upvotes: 0
Views: 844
Reputation: 15248
How about this?
head -n 1 A ; grep -f B A
chr gene start stop pval
2 ABD 5667 5789 0.03
5 GHE 4556 4784 0.34
Upvotes: 3