add a hyphen every 2 characters of every line

I have a text file like this with hundreds of lines:
>cat file1.txt
1027123000
1027124000
1127125000
1128140000
1228143000
>

all lines are very similar and have exactly 10 digits. I want to separate the digits by twodigit and hyphens....like so,
>
10-27-12-30-00
10-27-12-40-00
11-27-12-50-00
11-28-14-00-00
12-28-14-30-00
>

I just did some searching on this forum and it looks like I'll need a command that takes on this form:
sed "s/\([0-9]\......"
I need the exact notation though?

sed 's/\(..\)\(..\)\(..\)\(..\)\(..\)/\1-\2-\3-\4-\5/' file

thank you. wow yu make it look easy....
then if it is not too much trouble I also need a command that will add a "." between the first 4 numbers and the last 6 numbers....
>cat file1.txt
1027123000
1027124000
1127125000
1128140000
1228143000
>
ends up looking like this:
>cat file1.txt
1027.123000
1027.124000
1127.125000
1128.140000
1228.143000
>

I'm sure I can figure it out using yoru example, but easier to ask! :slight_smile:
thank you so much!!!
-A

>cat file13
1027123000
1027124000
1127125000
1128140000
1228143000
> awk '{print(substr($0,1,4))"."(substr($0,5,6))}' file13
1027.123000
1027.124000
1127.125000
1128.140000
1228.143000
> 

For the first:

perl -i~ -pe's/(..)(?!.?$)/$1-/g' infile

For the second:

perl -i~ -pe's/(.{4})/$1./' infile
sed 's/\(..\)/&-/g' file | sed 's/-$//'
sed 's/\(.\{2\}\)/&-/g;s/-$//' file

Or:

ruby -ne'puts scan(/../).join("-")' infile