Invert match
Remove comment and blank lines from a config file
grep -v '^#' /etc/nginx/nginx.conf | grep -v '^\s*$'
More grep commands
-
grep -r --include='*.py' 'import os' /srv/app/Limit recursive search to .py files only
-
grep -r --exclude-dir='.git' --exclude-dir='node_modules' 'TODO' .Search recursively skipping vcs and dependency dirs
-
grep -rn 'panic:' /var/log/app/Show file and line number for each match
-
rg 'TODO|FIXME|HACK' --type py -lList files containing TODO/FIXME/HACK in Python files
-
rg 'panic' -C3 --glob '*.go'3 lines of context around matches in Go files