awk '
{
for(i=1;i<=NF;i++){
sub(/[0-9]{4}$/,":&",$i)
sub(/:[0-9]{2}/,"&:",$i)
}
}
1
' <<<\
'034023 052030
034023 022130
044023 012030
034223 022030
034123 152030
024023 152030'
produz:
03:40:23 05:20:30
03:40:23 02:21:30
04:40:23 01:20:30
03:42:23 02:20:30
03:41:23 15:20:30
02:40:23 15:20:30
Outros scripts são
1.
#!/usr/bin/awk -f
gsub(/[0-9]{4}\>/,":&") &&
gsub(/:[0-9][0-9]/,"&:")
2.
#!/usr/bin/awk -f
gsub(/[0-9]{2}\B/,"&:")
3.
#!/usr/bin/awk -f
BEGIN{
FS=OFS=""
}
/[0-9]{6} [0-9]{6}/{
$3=":"$3
$4=$4":"
$11=":"$11
$12=$12":"
print
}
4.
#!/usr/bin/awk -f
/[0-9]{6} [0-9]{6}/{
printf("%02d:%d:%s:%d:%d\n",
substr($0,0,2),
substr($0,3,2),
substr($0,5,6),
substr($0,11,2),
substr($0,13,2))
}