Skip to content

Instantly share code, notes, and snippets.

@JonasAlfredsson
Created February 21, 2020 13:13
Show Gist options
  • Save JonasAlfredsson/ac6c3b31d60bf524b9b83fd7f3a8fc80 to your computer and use it in GitHub Desktop.
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 #)
# 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
}
@Keinkil
Copy link

Keinkil commented Feb 21, 2020

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment