sinewalker
7/16/2018 - 11:07 PM

Comment / un-comment a line in a config file, matching a pattern, using sed

Comment / un-comment a line in a config file, matching a pattern, using sed

sed -i '/pattern/s/^/#/g' file   #to comment out
sed -i '/pattern/s/^#//g' file   #to uncomment