Skip to content

Instantly share code, notes, and snippets.

@tralston
Created April 12, 2018 02:40
Show Gist options
  • Save tralston/dbac147078edf6725f405ef7fd3e0b5b to your computer and use it in GitHub Desktop.
Save tralston/dbac147078edf6725f405ef7fd3e0b5b to your computer and use it in GitHub Desktop.
[Find files based on return value of function]
# Will find files based on if the magic file type 'file $file.ext' matches pattern, then print the filename
# e.g. look for sqlite dbs
find . -type f -exec sh -c 'case "$(file -b "$0")" in *"SQLite"*) true;; *) false;; esac' {} \; -print
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment