I am trying to figure out how to automatically search and comment out specific lines within the /etc/sudoers file. I have the following lines to change...
I need them to look like...
I tried the following lines of code in backticks...
`perl -pi -e 's/.+Defaults env_reset.+/
#Defaults env_reset/g' /etc/sudoers`
`perl -pi -e 's/.+Defaults requiretty.+/
#Defaults requiretty/g' /etc/sudoers`
The ".+" is to match any number of characters before or after the phrase. I think I may be using it wrong, but I am not sure. Any thoughts or ideas are greatly appreciated. Thanks in advance!