Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

why I can't find files with substrings with "find" command

I am trying something super basic but I don’t get why my find command cannot find a substring. Here is the output

15:04b0 gmmo@mylinuxbox ~/test_search> cat somefile.txt 
find substring here!
15:04b0 gmmo@mylinuxbox ~/test_search> find . -name "*sub*" -print
15:04b0 gmmo@mylinuxbox ~/test_search>  

Does the string inside the quotes need to be regex?

I am following this thread

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Find all files with name containing string

What is the proper syntax to find all file containing a sub-string case insensitive in it recursively ideally?

>Solution :

Dont be confused by filenames and text content:

find . -type f -exec grep -il 'sub' {} +

or simply:

grep -ril 'sub' .

or with ack aka beyond than grep (faster):

ack -il 'sub'
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading