Insert text before first 'n' lines

I want to put a particular text, say, the hash '#' before each of the first n lines of a file.

How can I do that?

From line 1 to 3 , it will insert "#"

 sed '1,3 i #' filename

This will put a # symbol before each of the first 10 lines of a file. Modify accordingly.

sed '1,10s/^/#/' file

Put # before 10 first lines using awk .

awk 'NR<=10 {$0="#" $0} 1' file

balajesuri and Jtone's suggestion work fine. Thanks.