Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Post History
You can utilize grep's PERL regexes, more specifically lookarounds, to check presence of two (or more) words. $ grep -Prn . -e '^(?=.*\bfoo\b)(?=.*\bbar\b)' Here regex checks, that beginning of...
Answer
#1: Initial revision
You can utilize grep's PERL regexes, more specifically lookarounds, to check presence of two (or more) words. ```sh $ grep -Prn . -e '^(?=.*\bfoo\b)(?=.*\bbar\b)' ``` Here regex checks, that beginning of the line (`^`) is followed by words `foo` and `bar` somewhere in that line. Please notice, that since we are not actually matching said words, option `-w` is of no use, and we need to surround filtering words with boundary symbols. Demo of similar command online [here](https://ideone.com/Dhbm0S). Demo of regex with some additional explanation can be seen [here](https://regex101.com/r/JlB8Pv/1).