3 ms·
The shell, combined with grep already implements these intersection and difference operators. For intersection, all you have to do is pipe into a second grep
by pmiller2 13y ago
The shell, combined with grep already implements these intersection and difference operators. For intersection, all you have to do is pipe into a second grep [1]; for difference, you pipe into a second grep with -v [2].
[1] Intersection: grep regex1 file1 | grep regex2
[2] Difference: grep regex1 file1 | grep -v regex2
- eru 13y agoYes, you can do that. But you can only do that at the top level of your expression (ie outside the expression), not intra regular expression.