Find and List files containing/not containg a certain string

/ Published in: Bash
Save to your folder(s)

Find and List all the files with extension .file containing/not containing the given string "STRING"

The snippet is set to "containing", to switch it to "not containg" just replace "grep -l" with "grep -L"

containing : grep -l
not containing: grep -L

Copy this code and paste it in your HTML
  1. find . -type f -name "*.file" | xargs grep -l "STRING"

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.