I have two files:
files_to_search.out
terms_to_search.out
I'd like to create a command that identifies terms in terms_to_search.out that are not used in any of the files in files_to_search.out
Is there an easy way to do this?
|
|
|
This is a bit tricky if you want to account for terms that can overlap, e.g. a single line containing Here's a minimally-tested, quick-and-dirty perl script. It reads the strings to search (the needles) and the file names, then builds a regular expression that matches any of the needles. When it finds a match, it removes the matched string from the set of needles and rebuilds the regex. The needles that are left over at the end are the ones you're after.
|
|||
|
|
|
quick ugly attempt at a one liner (with GNU grep for the
|
|||||||
|