Skip to content

Instantly share code, notes, and snippets.

@tachi-hi
Created May 18, 2012 18:11
Show Gist options
  • Save tachi-hi/2726806 to your computer and use it in GitHub Desktop.
Save tachi-hi/2726806 to your computer and use it in GitHub Desktop.
A way to find the latest excel file
#!/usr/bin/bash
# >> ls *.xls
# xxx_v1.xls xxx_v10.xls xxx_v2.xls xxx_v3.xls
#
# we'd like to find the latest version.
ls *.xls | sed -e 's/.*_v\([0-9]*\).*/\1/g' | sort -n | tail -n 1
# or
ls xxx*.xls | sed -e 's/.*_v\([0-9]*\).*/\1/g' | sort -n | tail -n 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment