Skip to content

Instantly share code, notes, and snippets.

@jobel-code
Last active December 10, 2018 09:31
Show Gist options
  • Save jobel-code/b166f5136a862b0ce6ddb4b4a8122a4a to your computer and use it in GitHub Desktop.
Save jobel-code/b166f5136a862b0ce6ddb4b4a8122a4a to your computer and use it in GitHub Desktop.
Bash collection of find files with given text
# List all the files that contains `Text to find` in the `dirpath`
grep -l "Text to find" ~/dirpath/*
# Find all the yaml files, case insensitive (-i) that have "Text to find" and save it to to a text file.
# add -r for recursion.
grep -i --include="*.yaml *.yml" "text to find" dirptahToSearch/* > ~/saveResultsHere.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment