Unix command to find string set intersections or outliers?
grep, set, unix
Solution
It appears that `grep -L` solves the real problem of the poster, but for the actual question asked, finding the intersection of two sets of strings, you might want to look into the "comm" command. For example, if `file1` and `file2` each contain a sorted list of words, one word per line, then
$ comm -12 file1 file2
will produce the words common to both files. More generally, given sorted input files `file1` and `file2`, the command
$ comm file1 file2
produces three columns of output
- lines only in file1
- lines only in file2
- lines in both file1 and file2
You can suppress the column `N` in the output with the `-N` option. So, the command above, `comm -12 file1 file2`, suppresses columns 1 and 2, leaving only the words common to both files.
Problem
Is there a UNIX command on par with ``` sort | uniq ``` to find string set intersections or "outliers". An example application: I have a list of html templates, some of them have {% load i18n %} string inside, others don't. I want to know which files don't. edit: grep -L solves above problem. How about this: file1: ``` mom dad bob ``` file2: ``` dad ``` %intersect file1 file2 ``` dad ``` %left-unique file1 file2 ``` mom bob ```