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

Glib GIOChannel -

jsp - java.sql.SQLException: [Microsoft][ODBC Microsoft Access > Driver] Too few parameters. Expected 1 -

delphi - When I encode/decode SMS PDU (GSM 7 Bit) user data, do I need prepend the UDH first? -