Skip to content

Instantly share code, notes, and snippets.

@mmaha
Created February 2, 2011 15:55
Show Gist options
  • Save mmaha/807896 to your computer and use it in GitHub Desktop.
Save mmaha/807896 to your computer and use it in GitHub Desktop.
Does a locate on specified filetypes;
#!/usr/bin/env sh
# Might need to adjust awk $3 $4 according to OS
# Add $5 and so on to get more granularity
# This one is for Mac OSX
# *Test* it out with various files. YMMV.
locate "$1" | awk -F/ '{gsub($NF,""); print $3 "/" $4}' \
| sort | uniq -c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment