Home > Ubuntu Geek > How to find Text inside files in subdirectories

How to find Text inside files in subdirectories

I have to note it somewhere because my brain is always trying to exclude it.
# find . -name  “*.java ” | xargs grep  geecon

Advertisements
Categories: Ubuntu Geek
  1. December 10, 2010 at 10:52 pm

    a more efficient way of doing that may be:

    # find . -name “*.java” –exec grep geecon {} {} \;

    because it doesn’t need an explicit pipe and xargs. The two pairs of braces is a bit of a hack to display the file name which will as a result duplicate the output, perhaps this can be better done via a grep option.

  2. miragemiko
    December 12, 2010 at 10:02 am

    Yeap! I’ve forgotten … thanks for remind me, Cheers

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: