Documentation
¶
Index ¶
Constants ¶
View Source
const ( GrepIgnoreCase grepIgnoreCaseFlag = true GrepNoIgnoreCase grepIgnoreCaseFlag = false )
View Source
const ( GrepInvert grepInvertFlag = true GrepNoInvert grepInvertFlag = false )
View Source
const ( GrepWholeLine grepWholeLineFlag = true GrepNoWholeLine grepWholeLineFlag = false )
View Source
const ( GrepExtended grepExtendedFlag = true GrepNoExtended grepExtendedFlag = false )
View Source
const ( GrepWord grepWordFlag = true GrepNoWord grepWordFlag = false )
View Source
const ( GrepLineNumbers grepLineNumbersFlag = true GrepNoLineNumbers grepLineNumbersFlag = false )
View Source
const ( GrepCount grepCountFlag = true GrepNoCount grepCountFlag = false )
View Source
const ErrInvalidPattern errs.Const = "invalid pattern"
ErrInvalidPattern wraps a regular expression that fails to compile (-E/-w).
Variables ¶
This section is empty.
Functions ¶
func Grep ¶
Grep returns a Command that filters lines matching pattern. pattern is a required positional argument; the remaining options select the match mode.
Flags:
- GrepIgnoreCase (-i): case-insensitive matching
- GrepInvert (-v): emit non-matching lines
- GrepWholeLine (-x): match only when the whole line equals the pattern
- GrepExtended (-E): interpret the pattern as an extended regular expression
- GrepWord (-w): match only at word boundaries
- GrepLineNumbers (-n): prefix each emitted line with its line number
- GrepCount (-c): emit the count of matching lines instead of the lines
Types ¶
type GrepPattern ¶
type GrepPattern string
GrepPattern is the pattern grep matches each line against: a literal substring by default, or a regular expression under -E/-w.
Click to show internal directories.
Click to hide internal directories.