Last active
September 24, 2019 19:40
-
-
Save sephraim/dd1ffcbfa37c979b66052f25922e3cc7 to your computer and use it in GitHub Desktop.
Find files that contain one specific line but not another
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Find files that: | |
| # 1.) are .rb files | |
| # 2.) contain 'last_name' | |
| # 3.) do NOT contain 'name_suffix' | |
| # USING AG | |
| ag -LG '.*\.rb' 'name_suffix' . | xargs ag 'last_name' | |
| # USING GREP | |
| find . -name "*.rb" -print | xargs grep -l 'last_name' | xargs grep -L 'name_suffix' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment