Not sure what it is you want, maybe eklavya has assumed correctly, if not:
To comment out lines 4, 5 and 6:
Using vi:
Code:
in command mode
:4,6s/^/#/
Or, using sed:
Code:
sed -i.bak '4,6s/^/#/' infile
Commenting out all lines:
Code:
in command mode
:%s/^/#/
Or, using sed:
Code:
sed -i.bak 's/^/#/' infile
If neither of us have understood: Please elaborate.