Phil for Humanity

A Guide for the Survival of Humankind, and Improving the World, Society, and Yourself!


Popular Articles
  • Reasons For and Against
    Human Cloning
  • Globalization of the USA
  • The Pros and Cons of
    Capital Punishment
  • World's Stupidest Game

  • Latest Articles

  • How to Help Humanity
  • Why Economists Miss the Mark
  • Daylight Saving Time
  • Natural Log Proof
  • Subscribe to RSS Feed

  • Main Menu

  • HOME
  • SAVE HUMANITY (42)
  • HELP THE WORLD (96)
  • IMPROVE GOVERNMENTS (87)
  • PERSONAL DEVELOPMENT (238)
  • COMPUTER HELP (125)
  • ARCHIVE (all articles)
  • SEARCH THIS SITE
  • CONTACT US
  • DISCLAIMER
  • PLEASE HELP: DONATE

  • UNIX Support: Recursively GREP


    I'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.

    $ regrep.pl <WORD> [PATH1] [PATH2] ...

    The first argument is the only required argument for the value to search or grep for. All the remaining arguments are the directories where to start to recursively search for text file to grep. The default path is the current directory.

    You can download this Perl script here, or you can copy-n-paste from here:



    by Phil B.

    Related Articles
     » Generate Random Numbers
     » ClearCase Support: How to Find Checked Out Elements
     » ClearCase Support: Common ClearCase Labeling Error Message







    Copyright © 2006-2009, Phil for Humanity. All Rights Reserved.