#!/bin/sh # Find all files below cwd whose names end with one of a set of # extensions. Example usage: # # $ extfind txt org ltx # ./foo/bar/blah.txt # ./baz/qux/emax4evah.org # ./quux/thankyoudonandleslie.ltx # ./projects/jrandom/README.txt # ./also/note/that/matches-are-case-insensitive.TXT # $ # # Don't specify the dot before the extension. We define a filename's # extension as everything following the final dot in its basename. EXTS=$(echo -n "$@" | sed -e 's/[[:space:]]/|/g') find . -regextype egrep -iregex ".*\.(${EXTS})$" -print