[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
grep recursive
From: |
Pitcher, Michael |
Subject: |
grep recursive |
Date: |
Fri, 15 Jul 2011 15:01:43 +0000 |
I have a path with hidden directories (.foo):
server112-test/$ls -a -R .
.:
. .. bar .foo t1
./bar:
. .. .foo t2
./bar/.foo:
. .. t4
./.foo:
. .. t3
As you can see, ls -a shows all files.
Suppose I want to search recursively for a string ("test") in a file. Normally
I would expect the same rules to apply as for "ls" - ignore hidden files. But
grep doesn't work that way:
server112-test/$grep -R test *
bar/.foo/t4:test4
bar/t2:test2
t1:test1
Hmm. (Also, why did it skip ./.foo? Hmm.)
Now, suppose I want to recursively search all files, skipping the files in the
hidden directories, ".foo". Ok, this works for "./.foo" but - oops - not
bar/.foo:
server112-test/$grep -R --exclude=.foo test *
bar/.foo/t4:test4
bar/t2:test2
t1:test1
server112-test/$
The machine in question:
Linux version 2.6.9-22.ELsmp (address@hidden) (gcc version 3.4.4 20050721 (Red
Hat 3.4.4-2)) #1 SMP Mon Sep 19 18:00:54 EDT 2005
Linux server112 2.6.9-22.ELsmp #1 SMP Mon Sep 19 18:00:54 EDT 2005 x86_64
x86_64 x86_64 GNU/Linux
--
Mike Pitcher
address@hidden
919-281-1572
- grep recursive,
Pitcher, Michael <=