Let’s face it, when you are in the middle of developing your most recent genius idea, there are times you just need to find every instance of a function being used. For this, we can revert to the ‘find’ and ‘grep’ commands to narrow things down a bit. First, a little bit about the tools we’ll use:

Pipe, |

The pipe or | character is used to join command line requests into a single input and output. We’ll be using it to start the find command, look for an occurring, and avoid a negative case…all on the same data set.

Find

The find command is used to locate files on a Unix or Linux system. find will search any set of directories you specify for files that match the supplied search criteria. You can search for files by name, owner, uhoup, type, permissions, date, and other criteria. The search is recursive in that it will search all subdirectories too. In our case, we’re going to be looking at all files from the current directory and all sub-directories. This is noted by the period character ‘.’

Xargs

We will be using the ‘xargs’ command to build and execute command lines from standard input.

Grep

Grep is used to print lines matching a pattern. In our case we’ll be using the basic usage, as well as the ‘-v’ flag, for inversing the match. In this case, I use it to avoid any occurrences of the search term in a .svn folder.

So on with the commandline. So, I would like to search for all instances where my current project uses the ‘foo’ function:

$ find . | xargs grep "foo(" | grep -v .svn

Posted by Chris Klosowski

Chris Klosowski is the Director of Technology at Sandhills Development, LLC, creators of fine WordPress plugins, and ecommerce solutions.

10 Comments

  1. best generic viagra registered viagra with paypal – how much does viagra cost with insurance

    Reply

  2. where to get zithromax over the counter buy zithromax – how to get zithromax online

    Reply

  3. stromectol otc ivermectin cream cost – ivermectin 3mg pill

    Reply

  4. ivermectin 1 ivermectin for sale humans – order stromectol

    Reply

  5. ed treatments that really work prescription drugs without prior prescription – how to fix ed

    Reply

  6. ed drugs online from canada prescription drugs online without doctor – cheap erectile dysfunction

    Reply

  7. canada pharmacy lexapro lexaprognr – lexapro 10 mg tablet

    Reply

  8. plaquenil 200 mg online plaquenil – plaquenil 200 mg tablet

    Reply

  9. buy cialis cheap prices fast delivery cialis pills – cialis buy online canada

    Reply

Leave a reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.