Comnet out line of a file

Hi All

I need to coment out certain line from the /etc/X11/xorg.conf file for about 300 ueser, i cannot just copy over a correct copy becasue everyone has a slightly different one but i need a way to comment out certain line

i do not think i can do it with line number becaue everyones line number will be different

some sort of script i am thinking

thanks

Adam

give more clue : which line do you want to comment? in which file ?

example to comment param3 in a file called "tst" :

# cat tst
param1
param2
param3
param4
param5
# printf ",s/^param3.*/# &/\nwq\n" | ed -s tst
# cat tst
param1
param2
# param3
param4
param5

If you would have to do this for many users, you could easy loop over the corresponding files example to change such a line in a .profile file:

for i in /home/*/.profile
do
     printf ",s/^param3.*/# &/\nwq\n" | ed -s $i
done