awk split integer into several parts -


i have integer 20120305193821 , split several parts 2012-03-05-19:38:21 further usage in awk. can help?

if using gawk, can use fieldwidths:

echo 20120305193821 | gawk '{printf "%s-%s-%s-%s:%s:%s\n",       $1, $2, $3, $4, $5, $6}' fieldwidths="4 2 2 2 2 2" 

Comments

Popular posts from this blog

All overlapping substrings matching a java regex -

c++ - Using OpenSSL in a multi-threaded application -

php - Deleting/Renaming a locked file -