kevorski
kevorski

Reputation: 836

using grep to search

Hey guys I was just curious to see if someone could help me. I'm trying to search a directory recursively to find a file that has .poem as the extension and contains "I" in it.

when I do

grep -r -e --include *.poem I

I get nothing to show up

Upvotes: 0

Views: 79

Answers (2)

jlareau
jlareau

Reputation: 2860

To return the filenames only:

 grep -r -H "I" yourdir --include *.poem | cut -d: -f1 | uniq -u

Replace yourdir by the directory.

Upvotes: 1

Matt Ball
Matt Ball

Reputation: 359776

grep --include "*.poem" -R I .

Upvotes: 1

Related Questions