Last active
August 29, 2015 14:00
-
-
Save seqizz/f600753df20ddb9217f3 to your computer and use it in GitHub Desktop.
Parse date from filename (awk)
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
A reference for parsing date from name. This one parses "2014-04-13_xx-xx-xx" format and prints filenames named before 2 weeks. | |
ls -1 | sort | awk -F_ -v wk=`date --date="2 weeks ago" +%Y-%m-%d` '{if ($1 < wk) print $1"_"$2 }' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment