Skip to content

Instantly share code, notes, and snippets.

@gorillamoe
Created January 10, 2014 12:46
Show Gist options
  • Save gorillamoe/8351353 to your computer and use it in GitHub Desktop.
Save gorillamoe/8351353 to your computer and use it in GitHub Desktop.
Grep in files that are "revisioned" by filename like: test.1.xml, test.2.xml, test.3.xml. This script will only grep in the latest (highest number) file. It searches trough all subdirs too.
find . -name \*.xml -type f -print | cut -c3- | sort -k2 -t. -n -r | awk 'BEGIN{FS="."} a[$1] {next} {a[$1]=1} 1' | xargs grep mooo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment