Elitmiar
Elitmiar

Reputation: 36839

Searching within a whole directory and sub directories for a certain phrase

I'm having difficaultiesSearching within a whole directory and sub directories for a certain phrase using grep or a better command in linux to find a sentense'

I use the following command grep -rni this is a test * but it seems not to search correctly.

Am I doing something wrong?

Upvotes: 1

Views: 398

Answers (2)

phisch
phisch

Reputation: 4731

Add quotes to your search term. Otherweise, grep interpretes "this", "is", "a" and "test" as arguments.

the following should work:

grep -rin "this is a test" *

Upvotes: 2

ghostdog74
ghostdog74

Reputation: 342363

you need to quote your search term

grep -rin "this is a test" *

Upvotes: 5

Related Questions