Recursive grep skips / excludes / ignores all subdirectories

This is still my dumbest question. I'm sure this is stupidly obvious, but for my life I couldn't find a solution.

I just want to search all files in my current directory for a template, ignoring all subdirectories. Things I've tried:

grep "mytext" .

→ complains about it. this is a directory

grep -r "mytext" .

-> searches all subdirectories

grep "mytext"

→ just freezes (looking for the whole car?)

grep -rd skip "mytext" .

→ skips the current directory


source to share

1 answer

My last try was on the right track. I decided that I would answer the question about the offspring and not just delete it (which was tempting since I feel stupid for having to ask him).

The solution was to use wildcard skip directories. i.e.

grep -rd skip "mytext" ./*



All Articles