grepcmd

package
v0.0.0-...-226a73d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 13, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package grepcmd implements grep(1) per the GNU grep manual: print lines of each FILE (or standard input) that match PATTERNS.

Pattern dialects:

  • Default (BRE) is translated construct-by-construct — see bre.go. Patterns without back-references use RE2; patterns with \1..\9 use pkg/bre's bounded backtracking matcher.
  • -E (ERE): patterns without back-references use RE2 after translation of POSIX bracket expressions and GNU word-edge anchors; patterns with \1..\9 use pkg/bre's bounded backtracking matcher.
  • -F: fixed strings.

Binary files (NUL byte within the first 32 KiB) print one "Binary file NAME matches" line instead of the matching lines, per GNU behavior. -c/-l/-L/-q are unaffected by binary detection.

--include/--exclude rules are applied in command-line order; the last matching rule wins. Recursive entries match by base name, while explicit command-line files match any slash-delimited name suffix, per GNU.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL