MCPcopy
hub / github.com/bitfield/script / Match

Method Match

script.go:789–795  ·  view source on GitHub ↗

Match produces only the input lines that contain the string s.

(s string)

Source from the content-addressed store, hash-verified

787
788// Match produces only the input lines that contain the string s.
789func (p *Pipe) Match(s string) *Pipe {
790 return p.FilterScan(func(line string, w io.Writer) {
791 if strings.Contains(line, s) {
792 fmt.Fprintln(w, line)
793 }
794 })
795}
796
797// MatchRegexp produces only the input lines that match the compiled regexp re.
798func (p *Pipe) MatchRegexp(re *regexp.Regexp) *Pipe {

Calls 1

FilterScanMethod · 0.95