Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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