austin43 has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks,
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...Defaults env_reset Defaults requiretty
I tried the following lines of code in backticks...#Defaults env_reset #Defaults requiretty
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!`perl -pi -e 's/.+Defaults env_reset.+/ #Defaults env_reset/g' /etc/sudoers` `perl -pi -e 's/.+Defaults requiretty.+/ #Defaults requiretty/g' /etc/sudoers`
Back to
Seekers of Perl Wisdom