I have two lists, a complete list and a partial list. I want a bash script that will search the complete list for any lines that are in the partial, if there are, they will be removed from the complete list. Can anyone help?
How to remove lines included in one file from another file
text processing
Best Answer
grep
can read multiple patterns from a file, one per line. Combine with the options-v
to output non-matching lines, and-F
to match strings instead of regex and-x
to require that the whole line matches.Obviously the second command line is only if you want to overwrite the file containing the complete list.
If the partial list is huge and you don't mind reordering the list, then
join
may be faster.