Skip to content

Instantly share code, notes, and snippets.

@miebach
Created July 14, 2011 18:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miebach/1083152 to your computer and use it in GitHub Desktop.
Save miebach/1083152 to your computer and use it in GitHub Desktop.
Show only relevant lines in linux config files
cat some.conf | sed 's/^[ \t]*//' |grep -v ^# | sed '/^$/d'
# as result all non-blank lines from some.conf that do not start with a "#" (which means this only a comment line) are printed to the terminal
# in short: show the lines that contain something relevant
# the first sed removes trailing spaces from all lines
# the grep removes all lines that start with a "#"
# the second sed removes all blank lines
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment