Loading...

Comment and uncomment files with sed

If you have the need to comment a whole file sed is very handy to comment and uncomment files.

sed -i 's/^\([^#]\)/#\1/g' /etc/monit/elasticsearch

To uncomment remove all # at the beginning of each line.

sed -i 's/^#//g' /etc/monit/elasticsearch