Skip to content

Instantly share code, notes, and snippets.

@ngocnguyenth
Forked from haisum/script.sh
Created January 9, 2019 02:23
Show Gist options
  • Save ngocnguyenth/48ba4f34120c94533e735c5c7d564819 to your computer and use it in GitHub Desktop.
Save ngocnguyenth/48ba4f34120c94533e735c5c7d564819 to your computer and use it in GitHub Desktop.
comment and uncomment lines in bash script via sed
sed -i '/<pattern>/s/^/#/g' file #comment
sed -i '/<pattern>/s/^#//g' file #uncomment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment