I had a problem where I had to match specific lines in a file and append characters in front of the line.
Regular see works like this:
$ head dates1.txt | sed 's/^[0-9][0-9]\./,[0-9][0-9]/'
,[0-9][0-9]04.2011
vj,30.06.2011
,[0-9][0-9]06.2011
,[0-9][0-9]09.2011
,[0-9][0-9]05.2011
vj,03.05.2011
2.vpj,21.04.2011
The problem here is sed replacing its match.
The fix is to use & character in regex string (I found the solution from here.
$ head dates1.txt | sed 's/^[0-9][0-9]\./,&/'
,20.04.2011
vj,30.06.2011
,30.06.2011
,15.09.2011
,03.05.2011
vj,03.05.2011
2.vpj,21.04.2011