Last active
December 20, 2015 20:59
-
-
Save danhart/6193895 to your computer and use it in GitHub Desktop.
Find lines matching filenames in a directory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# First argument is the directory containing the filenames you wish to match against for | |
# Second argument is the directory you wish to search within | |
# e.g. matching_filenames public/images public/less | |
# will match against all filenames (recursively) in public/images by searching the public/less directory | |
# Tested on OS X | |
# Dependency: Ack | |
function matching_filenames() { | |
find ${1} -type f -exec basename {} \; | xargs -L1 -J % ack % ${2} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment