i tested this but i have all genes not only those in the file1 me i need to extract only genes present in file1 and not in file2
Extract rows present in file1 and not in file 2
I have two files with genes
File one (with 40000 genes)
Gene 1
Gene 2
Gene 3
Gene b
Gene f
Gene c
Gene r
Gene z
File two (with 39000 genes)
Gene 1
Gene 3
Gene 2
Gene b
I would like to know if there is a command line (with awk or bash) to extract that lines that exist in the one file and not in the two file
• 7,448 views
•
link
3 answers
I would like to know if there is a command line (with awk or bash) to extract that lines that exist in the one file and not in the two file
use comm : http://man7.org/linux/man-pages/man1/comm.1.html
comm -3 <(sort file1.txt) <(sort file2.txt )
• 0 views
•
link
• 0 views
•
link
only in 1st:
comm -23 <(sort file1.txt) <(sort file2.txt )
only in 2nd
comm -13 <(sort file1.txt) <(sort file2.txt )
• 0 views
•
link
Log in to answer this question.