Recursively find all documents that match a file name and contain a string
2 comments. Current rating: (1 votes). Leave comments and/ or rate it.
Question:I need to recursively find all documents where the file name matches a certain pattern ('index*') and that contain a certain string ('update'). How do I do this in Linux?
Answer:You need a combination of find to locate those index* files and grep to only list those that have the keyword 'update' in it.
The following command will do the trick.
Note: if you want a 'negative search', meaning list all documents that do NOT contain 'update', then add the -v parameter to grep.