For an input file named Lab1:
034023 052030
034023 022130
044023 012030
034223 022030
034123 152030
024023 152030
AWK command
awk 'gsub(/[0-9][0-9]/,"&:",$1) gsub(/[0-9][0-9]/,"&:",$2)' Lab1
results in:
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:
How can I prevent the trailing colons?
desired result
03:40:23 05:20:30
03:40:23 02:21:30
sed -r 's/([0-9]{2})([0-9]{2})\>/:\1:\2/g'sed -r 's/[0-9]{2}\B/&:/g'