|
Popular Articles
Latest Articles
![]()
Main Menu
|
UNIX Support: Recursively GREPI've always had two major problems with the UNIX "grep" command. First, the "grep" command will gladly read a non-text file, and thus produce garbage if the grep pattern was found. Second, the "grep" command can be used to search in all the files in a single directory, but the command will not recursively search all sub-directories. As a result, I wrote a Perl script, called recursive grep or "regrep.pl", to resolve these issues. Here is the syntax to run this script.
The first argument is the only required argument for the value to search or grep for. The optional "PATH" arguments that can be next are the directories where to start to recursively search for text files to grep. The default path is the current directory. Finally, the last optional argument is for these options:
Alternatively, you can just use the "-help" argument to see the usage and some examples of how to use this script. You can download this Perl script here, or you can copy-n-paste from down below. I would like to thank Monty Scroggins for enhancing this script with more options and teaching me a bit more Perl. by Phil B.
|