As the title, I want to take out the lines in file2 if the TCONS_* matches that in file1. Then put the lines in a file3. The TCONS numbers ranges from TCONS_00000024 to TCONS_00381684. Those numbers are continuous in file2, not in file1. Below is just some lines of file1 and file2
Thanks Joey. But I need to compare all the transcript id in file1 and file2, so I need to use some loops. I'm quite new to perl, could you please give me more details about the codes?
# this makes file3
grep -f file1 file2 > file3
# selectively lose lines in file2 that are in file1
grep -f -v file2 file2 > tmpfile
# read and check that tmpfile is correct. then
mv tmpfile file2
You don't need perl or loops, joeyg gave you great advice.
Does the "grep -vf file1 file2>tmpfile" mean move the the lines in file2 that are not in file1 to tmpfile? I don't need those that don't match.
What does the the first line mean?
Thanks very much.