Created
February 21, 2020 13:13
-
-
Save JonasAlfredsson/ac6c3b31d60bf524b9b83fd7f3a8fc80 to your computer and use it in GitHub Desktop.
Print all lines in a config file which are _not_ commented out (i.e. lines using #)
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
# Place this function inside your `.bashrc` or `.zshrc` file, source it, and use | |
# it by calling on it from your terminal like this: | |
# | |
# $ conf_grep settings-file.conf | |
# | |
# This will find and print a sorted list of all the lines which do _not_ have a | |
# pound/hashtag (#) sign at the beginning (leading spaces are ignored), i.e. | |
# print all lines which are not comments. | |
conf_grep () | |
{ | |
egrep '^[[:blank:]]*[^[:blank:]#]' $1 | sort | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
+1