If the replacement needs to take place only in lines containing the pattern 'aaa', you could try the following:
Code:
sed -e '/aaa/ s/^/#123/g' file
It will insert '#123' at the beginning of each line containing the pattern 'aaa'
As it was mentioned before, you need to use the switch -i to actually modify the file.
HTH
edit: hope it's not your homework, is it?