Skip to content

Instantly share code, notes, and snippets.

@xlson
Created May 5, 2011 09:23
Show Gist options
  • Save xlson/956780 to your computer and use it in GitHub Desktop.
Save xlson/956780 to your computer and use it in GitHub Desktop.
Search for text in certain files using grep (find + grep)
#!/bin/bash
NAME_PATTERN=$1
GREP_TEXT=$2
find . -name "$NAME_PATTERN" -exec grep -H "$GREP_TEXT" '{}' \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment