Grep without Hidden files

I wanted to grep some text Recursively, without going through hidden files(.files/.folders)

In my Repo there are lot of .svn folders/subfolders etc.
I dont want to grep in that folders.
Hidden folders can be .svn or .<anyotherfoldername>

Can you give teh command whcih does it "Recursively"

You can use find , no? Investigate the "-prune" clause to cut away certain directories from further descending through them.

I hope this helps.

bakunin

Not sure I understand. Usually, if you don't explicitly specify the leading dot, those files will be left untouched/ungrepped.

Try this: -

grep <pattern> */*

hidden files will left un-grepped.

This is all I understand from your question.

HTH

find . -name '.*' -prune -o -type f -exec grep thisstring /dev/null {} +

That will prune "." (in addition to the directory names you want to prune starting with "."), which will leave you with no matches. Try:

find . -name '.?*' -prune -o -type f -exec grep thisstring /dev/null {} +
1 Like