-
-
Save superatomic/7e4484ef568c921f9feb9ce83aa1ea78 to your computer and use it in GitHub Desktop.
lst: strip comments, empty lines, and indentation from files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sed -rf- -- "$@" <<-EOF | |
s/([^#]*)#.*$/\1/ # remove comments | |
s/^\s*//;s/\s+$// # strip leading and trailing whitespace | |
/^$/d # remove blank lines | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment