Skip to content

Instantly share code, notes, and snippets.

@liuliqiang
Forked from haisum/script.sh
Created December 11, 2018 06:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save liuliqiang/ef2633e2ed466d9bc6ebeb4c7a9803c8 to your computer and use it in GitHub Desktop.
Save liuliqiang/ef2633e2ed466d9bc6ebeb4c7a9803c8 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