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

Method Column

script.go:240–247  ·  view source on GitHub ↗

Column produces column col of each line of input, where the first column is column 1, and columns are delimited by Unicode whitespace. Lines containing fewer than col columns will be skipped.

(col int)

Source from the content-addressed store, hash-verified

238// column 1, and columns are delimited by Unicode whitespace. Lines containing
239// fewer than col columns will be skipped.
240func (p *Pipe) Column(col int) *Pipe {
241 return p.FilterScan(func(line string, w io.Writer) {
242 columns := strings.Fields(line)
243 if col > 0 && col <= len(columns) {
244 fmt.Fprintln(w, columns[col-1])
245 }
246 })
247}
248
249// Concat reads paths from the pipe, one per line, and produces the contents of
250// all the corresponding files in sequence. If there are any errors (for

Callers 2

TestColumnSelectsFunction · 0.80
ExamplePipe_ColumnFunction · 0.80

Calls 1

FilterScanMethod · 0.95

Tested by 2

TestColumnSelectsFunction · 0.64
ExamplePipe_ColumnFunction · 0.64