Find files that contain the word 'xxx' but do not contain the word 'yyy' in the same file
```bash
grep -rl 'xxx' /path/to/search/* | xargs grep -L 'yyy'
```
This command first searches for files containing 'xxx' using the `-r` (recursive) and `-l` (only file names) options. Then, it pipes the results to `xargs` to search for files that do not contain 'yyy' using the `-L` option.
Make sure to replace `/path/to/search/*` with the actual path or file pattern you want to search.
Comments
Post a Comment