Two Guys Arguing

Notes to self: Find all files NOT containing text

Posted in Uncategorized by benjaminplee on 02.09.10

Handy script to find all files in a given subfolder that do NOT contain a certain text line. Sorted for easy reading:

find ./PATH/TO/FOLDER -type f -size +1c ! -exec grep -q ‘SEARCH TEXT’ {} \; -print | sort

About these ads

4 Responses

Subscribe to comments with RSS.

  1. udtek1 said, on 04.18.10 at 10:48 pm

    http”//www.udtek.com

  2. JDG said, on 11.08.10 at 6:38 am

    Just what I needed! Thanks for saving me a few hours.

  3. benjaminplee said, on 11.08.10 at 10:01 am

    Glad it helped.

  4. roland said, on 07.10.11 at 9:08 pm

    doesn’t work for me at all. no matter what i put in the search string, every file in the path comes back.


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

Follow

Get every new post delivered to your Inbox.