Interview Prep/Linux/Packages, Shell & Text Tools

How does grep work, and which flags do you use daily?

BeginnerConceptPackages, Shell & Text Tools
Answer
grep -i "error" app.log            # case-insensitive
grep -rn "listen" /etc/nginx/      # recursive with line numbers
grep -v '^#' file | grep -v '^$'   # strip comments and blank lines
grep -E 'timeout|refused' app.log  # extended regex
grep -c 500 access.log             # count
grep -A3 -B2 Exception app.log     # context
grep -o 'id=[0-9]*' app.log        # only matching part
All Linux questions Roadmap: Linux

More on Packages, Shell & Text Tools