Reputation: 473
This is going to be my dumbest question yet. I'm sure it's stupidly obvious, but for the life of me, I could not find a solution.
I simply want to search all files in my current directory for a pattern, ignoring all subdirectories. Things I've tried:
grep "mytext" .
-> complains that . is a directory
grep -r "mytext" .
-> searches all subdirectories
grep "mytext"
-> just freezes (searching entire machine?)
grep -rd skip "mytext" .
-> skips current directory
Upvotes: 3
Views: 72
Reputation: 473
My last attempt was on the right track. I figured I'd answer the question for posterity instead of just deleting it (which was tempting since I feel stupid for having to ask it in the first place).
The solution was to use the skip directories with a wildcard. i.e.
grep -rd skip "mytext" ./*
Upvotes: 2