I have one tab delimited file with column 1 being an ID and column 2 being information. I've a second file with a list of IDs that need to be removed from the first file. When I use grep, I either get a copy of the first file with no changes or I get a blank file using -v with -F -f "file2.txt" flags/arguments. My question is: How do I use file2.txt to compare the IDs from it with file1 to eliminate those rows from file1 to output into file3.
awk 'BEGIN{RS=">"}NR>1{sub("\n","\t"); gsub("\n",""); print RS$0}' $1 > fasta.tab
grep -F -f $2 fasta.tab -v >rmOutput.tab
tr '\t' \n' <rmOutput.tab >rmOutput.fas
echo Runtime Complete
Line 1: Create tab-delim file from input 1 Line 2: Check input 2 for matches and remove those from tab-delim file Line 3: recreate format of input 1 (For clarity)
EDIT: Sample I/O
Input 1 (tab-delim--after line 1):
ID1 Info1
ID2 Info2
ID3 Info3
ID4 Info4
ID5 Info5
Input 2 (IDs to be deleted):
ID2
ID4
ID5
Desired Output (from line 2)
ID1 Info1
ID3 Info3