automate editing /etc/yum.conf

Does anyone know how I can do the equivalent of this via a script:

open /etc/yum.conf
:%s/gpgcheck=1/#gpgcheck=1
(this part comments out gpgcheck=1 throughout the file with a search/replace).

Ideas? The script doesnt need to use vi, any search/replace option would work.

 

 

 

 

Top