find, xargs and grep

You want to find files that contain certain characters. I found a way to do it and here it is for my note.

find . -name '*.py' -type f | xargs grep -n 'text I wanna look for'

This command looks for Python files that contains ‘text I wanna look for’.

Leave a Reply

Your email address will not be published.