1

Selected lines from a file based on another file

view story
linux-howto

http://www.unix.com – Hello, I am using Awk in Ubuntu 12.04 First file: I have a file like this: Code: SNP1  1  198.2  SNP2  1  124.5 SNP3  1  124.4 . . . Second file: I have another file like this: Code: SNP2 SNP5 SNP10 . . . I want to create a third file like my first file but keeping ONLY the SNPs that exist in the second file using Awk. For example like an output: Code: SNP2 1 124.5 SNP5 1 433.5 SNP10 1 454.2 Thank you very much in advance. (HowTos)