filter

cmd/filter

Search file content (grep-like)

Overview

filter searches text content in files (grep-like behavior).

Useful options include:

  • --ignore-case, --line-number, --count
  • --recursive, --files-only, --fixed
  • --before, --after, --context

Example usage:

filter error app.log
filter --ignore-case --line-number timeout logs/*.log
filter --recursive --files-only panic ./services
filter --fixed --count "request id" api.log

Usage

  • filter <pattern> [file...] [options]

Flags

FlagTypeDescription
-after int Show N lines after match
-before int Show N lines before match
-context int Show N lines before and after match
-count - Only show match count per file
-files-only - Only show filenames with matches
-fixed - Treat pattern as fixed string, not regex
-ignore-case - Case-insensitive search
-invert - Invert match (show non-matching lines)
-line-number - Show line numbers
-quiet - Quiet mode (exit 0 if match found)
-recursive - Search directories recursively

Exit Codes

CodeMeaning
0 Success
1 Runtime/command error
2 Invalid flags/usage