How do I recursively search subdirectories with grep?

Martin

Lifer
Jan 15, 2000
29,178
1
81
tried google, it suggest the switch -R, but that's not installed the machine I am working.

any other ways to do it?

I am trying to search for a string in many different source files, located in many different directories.
 

hevnsnt

Lifer
Mar 18, 2000
10,868
1
0
Type "man grep" :p

-d ACTION, --directories=ACTION
If an input file is a directory, use ACTION to pro-
cess it. By default, ACTION is read, which means
that directories are read just as if they were
ordinary files. If ACTION is skip, directories are
silently skipped. If ACTION is recurse, grep reads
all files under each directory, recursively; this
is equivalent to the -r option.
 

mAdD INDIAN

Diamond Member
Oct 11, 1999
7,804
1
0
Originally posted by: Martin
tried google, it suggest the switch -R, but that's not installed the machine I am working.

any other ways to do it?

I am trying to search for a string in many different source files, located in many different directories.

Are you trying to find DEBUG statements in the src?

Just do the diff statement and pipe that to a file. Then use grep on it.

cvs diff -c > difference
grep 'DEBUG' difference
 

Martin

Lifer
Jan 15, 2000
29,178
1
81
Originally posted by: mAdD INDIAN
Originally posted by: Martin
tried google, it suggest the switch -R, but that's not installed the machine I am working.

any other ways to do it?

I am trying to search for a string in many different source files, located in many different directories.

Are you trying to find DEBUG statements in the src?

Just do the diff statement and pipe that to a file. Then use grep on it.

cvs diff -c > difference
grep 'DEBUG' difference

I'm trying to find examples of how they use DEBUG in the code, as I am not quite sure how to use it. Do you know?


hevnsnt, -d isn't installed either.
 

mAdD INDIAN

Diamond Member
Oct 11, 1999
7,804
1
0
Originally posted by: Martin
Originally posted by: mAdD INDIAN
Originally posted by: Martin
tried google, it suggest the switch -R, but that's not installed the machine I am working.

any other ways to do it?

I am trying to search for a string in many different source files, located in many different directories.

Are you trying to find DEBUG statements in the src?

Just do the diff statement and pipe that to a file. Then use grep on it.

cvs diff -c > difference
grep 'DEBUG' difference

I'm trying to find examples of how they use DEBUG in the code, as I am not quite sure how to use it. Do you know?


hevnsnt, -d isn't installed either.

DEBUG(DB_whatever is listed in lib.h, "Message");

that's how you use it.
 

Martin

Lifer
Jan 15, 2000
29,178
1
81
Originally posted by: mAdD INDIAN
Originally posted by: Martin
Originally posted by: mAdD INDIAN
Originally posted by: Martin
tried google, it suggest the switch -R, but that's not installed the machine I am working.

any other ways to do it?

I am trying to search for a string in many different source files, located in many different directories.

Are you trying to find DEBUG statements in the src?

Just do the diff statement and pipe that to a file. Then use grep on it.

cvs diff -c > difference
grep 'DEBUG' difference

I'm trying to find examples of how they use DEBUG in the code, as I am not quite sure how to use it. Do you know?


hevnsnt, -d isn't installed either.

DEBUG(DB_whatever is listed in lib.h, "Message");

that's how you use it.

That's what I did, though I wasn't sure where to put them, so I stuck a bunch of them in thread.c and device.c. I guess we'll see how right I was on friday...
 

mAdD INDIAN

Diamond Member
Oct 11, 1999
7,804
1
0
Originally posted by: abc
i forgot, what's the grep command | supposed to do...

it's supposed to look for a string in a file.

Martin: Did you enable flags by doing "set dbflags=0xffff" in the gdb?