adding a character in front of a line

Hi everyon,
I am trying to search for a pattern in a file and add "//" to the begining of the file.
lets say i want to comment out a line from my codes. the line that should be commented out contains the word "reset". i need to search for the word "reset" and comment out that specific line. is there anyone who could help me with this?

Thanks,

Try sed

sed 's%reset%//&%g' file

Try these examples:-

// finds 123 and puts 'a' in front of it
bash# echo "123 abc" | sed 's/123/a &/'
a 123 abc

//finds abc and puts 'a' in fron of it
bash# echo "123 abc" | sed 's/abc/a &/'
123 a abc

Hi,

Try this,

sed '/reset/s%^%//%g'

Regards,
Chella

thanks everyone,
it works just fine now. it was very helpful

I have a similar question, what is i want to comment out that line and also couple of lines above and under that specific line. the reason that i don't use the same method to comment out the other lines is that they contain a similar pattern as some other lines in my code; therefore i need a method to comment out couple of line above and below the specific line