How do I run a recursive grep in AIX 5.1?

Pretty self explanatory.

Ain’t no -r flag.

Why ain’t there no -r flag?

My boss just gave me permission to spike the p630, and our AIX guy isn’t around today to help me.

I suppose I could pipe find to it…

I don’t have access to an AIX box right now, but this should be relatively platform agnostic–may be worth a shot:



find /path/to/search | xargs grep re-to-use

Should have added–you can’t pipe “find” straight to grep, because otherwise you’ll just be searching through the list of file names. You need to invoke “grep” on the files, not just their names. You can do that with the “xargs” command I just gave, or you can use find to do it (e.g., you can usually do something like:


find /path/to/search -exec grep re-to-use '{}' ';' -print

)
However, find’s argument list isn’t very standard, and the above find command will run grep once-per-file, whereas “xargs” will run the command once-per-many-files (exactly how many depends on the operating system and the number of arguments to the command xargs is executing), which is much more efficient.

Thanks, Metacom. That worked perfectly.