Let's say I have FileA.txt which looks a bit like this:
43287134, string1, string2
1233, foo, bar
973, barfoo, foobar
7464, asdf, ghjk
And I've got FileB.txt with these regexes, separated by a line:
^973,
^1233,
I would like to apply FileB.txt regexes onto FileA.txt, and delete the lines that match so that final result would be:
43287134, string1, string2
7464, asdf, ghjk
Is there any tool available to do this? Thanks!
Best Answer
This is exactly what
grep
is designed for:-f <filename>
reads regexes from the file (instead of command line)-v
reverse the match (prints non-matching lines)Output: