Created
July 19, 2017 19:37
-
-
Save devinnasar/9352bb8b4eb75e5ce0ed305b0b929cde to your computer and use it in GitHub Desktop.
This file contains 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
# Gets the most recent directory under an s3 path | |
aws s3 ls "${_s3socpath}/tc-east-10/" | # list contents of s3 path | |
grep "PRE" | # filter for PRE (prefix) entries | |
awk '{printf $2"\n"}' | # print the second column of output (remove the PRE column) | |
sed 's/\/$//' | # cut the trailing slash off of paths | |
sort -r -n -t"-" -k1 -k2 -k3 | # sort the output: reverse, with a delimiter of hyphen ('-'), by the year, then month, then date | |
sed -n 1p # return the first line of output only |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment