Skip to content

Instantly share code, notes, and snippets.

@firedynasty
Created October 22, 2021 04:17
Show Gist options
  • Save firedynasty/0d58a95a358a33c45b229792f733c18d to your computer and use it in GitHub Desktop.
Save firedynasty/0d58a95a358a33c45b229792f733c18d to your computer and use it in GitHub Desktop.
delete all comments from a text file
function delete() {
echo "sed -i '' '/^#/d'"
echo "sed -i '' '/^$/d;G'"
}
in command line for mac:
$ sed -i '' '/^#/d' (yourfilename here)
removes all the lines starting with the symbol (comment) #
$ sed -i '' '/^$/d;G' (your filename here)
removes all the lines that have multiple lines after running the above command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment