FileA.txt: ATGCATGC GGGGGGTTTTTTTAAAAFileB.txt: asdfasdfblah2ATGCATGCblah3blah4 delte-me-tooGGGGGGTTblah5blah5....I want to compare the each line from FileA.txt and check if it is in FileB.txt. If it is in FileB, I want to delete the following:Matched Line One line above Two lines belowand output into a new file. NOTE: There will be 500,000 lines in FileA. I would like to do this in a way which we do not hardcode the patterns. I currently have something to delete the lines, but I'm getting tripped up about the looping through FileA to create a new pattern for this awk expression:awk '/$VARIABLE_REGEX/{for(x=NR-2;x<=NR+2;x++)d[x];} {a[NR]=$0}END{for(i=1;i<=NR;i++)    if(!(i in d))        print a[i]}' FileB.txt
How to loop through a file and make each line a new regular expression into an awk statement?
command line;text processing;large files
Note: No error checking. Also, assumption is that the input in 2nd file follows the pattern mentioned exactly. awk 'NR== FNR {a[$0] = $0 ; next } {if (!($0 in a)) {b[count++] = $0; } else {count--; if (count > 0) delete b[count];getline;getline; }} END {for (i=0; i<count; i++) print b[i] }' 1 2inputs are in 1 and 21ATGCATGCGGGGGGTTTTTTTAAAA2asdfasdfblah2ATGCATGCblah3blah4 delte-me-tooGGGGGGTTblah5blah5foofoo-deleteAAAAbar-deletebar-deletebar-okOutputasdfasdffoobar-ok