3

I have two different regular files: myscript2 and myscript3 with word 'dash' inside. I want to grep them, but because of '-r' addition to grep I got hidden files as well. I tried to use 'grep -v' after pipe to get rid of hidden files. I failed. Why? What to do to solve my problem?

$ ls
myscript2
myscript3
$ cat myscript2
dash
$ grep -r -l 'dash' | grep -v '^.*'
Josef Klimuk
  • 1,596

1 Answers1

3

Try --exclude:

grep -R --exclude='.*' <pattern> <dir>
thomasrutter
  • 36,774