LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Searching for string inside files (https://www.linuxquestions.org/questions/linux-software-2/searching-for-string-inside-files-4175545091/)

alaios 06-11-2015 10:48 AM

Searching for string inside files
 
Dear all,
I would like to search inside my files (and into all subdirectories) for a string that might look like

Oxford
oxford
oxfordian
1fxord2
0xford9

(the common part is the xford)

What I am currently trying is the
grep -RilF '*xford*'


althoug my research does not return anything for days now.

What I am doing wrong?

Regards
Alex

Habitual 06-11-2015 11:05 AM

Alex:
Try
Code:

find -type f -exec grep -il xford  {} \;
John

alaios 06-12-2015 02:59 AM

Thansk a lot I am trying it

pan64 06-12-2015 03:46 AM

you do not need *, just write:
grep -RilF xford <dir>
* has a special meaning

rtmistler 06-12-2015 06:48 AM

I like both the offered solutions. In the future, do not allow a search to continue for "days". If you truly expect that the occurrence of that string is extremely rare, then create a few test files to validate your search criteria, or in the more normal case, do realize that there's something wrong with your search spec if it stays up for some long time with no results.


All times are GMT -5. The time now is 10:01 PM.