Skip to content

Instantly share code, notes, and snippets.

@weakish
Created June 3, 2011 03:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save weakish/1005791 to your computer and use it in GitHub Desktop.
Save weakish/1005791 to your computer and use it in GitHub Desktop.
#sh script to convert date formats
#!/bin/sh
# by Jakukyo Friel <weakish@gmail.com> under GPL v2.
### This script convert date formats:
# YYYY-MM-DD => YYYY-MM-DD
# YYYY-M-DD => YYYY-MM-DD
# YYYY-MM-D => YYYY-MM-DD
# YYYY-M-D => YYYY-MM-DD
sed -r 's/-([1-9]-)/-0\1/g' | sed -r 's/-([1-9])($|[^-0-9])/-0\1\2/g'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment