Skip to content

Instantly share code, notes, and snippets.

@sparkida
Last active December 30, 2015 03:59
Show Gist options
  • Save sparkida/7772918 to your computer and use it in GitHub Desktop.
Save sparkida/7772918 to your computer and use it in GitHub Desktop.
First find all files of type ".rb" in current directory, then search each file for "config" and display matched files
#!/bin/bash
#Find matching text in all files
find . -type f -name "*.rb" | while read file; do found=$(sed -n 's/config//p' "$file"); if [ ! -z "$found" ]; then echo "$file"; fi; done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment