Quote:
N.B. anyone who is any good at Unix shell scripts, sed and the like, cover your eyes now.


It was pretty hard to read with my eyes covered , but...

How about replacing the two first scripts with this:

Code:

sed -n -e '3s/^....\(..\)\.\(..\)/\1\2\n0\n0\n0/p'



Given your input data, it produces:
Code:

1268
0
0
0