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