fields
Use fields
to chop input into selectable columns.
Project Overview
Module gophers.dev/cmds/fields
provides a command-line utility for processing
columns of input text.
Getting Started
Install from SnapCraft
The fields
command can be installed as a snap
$ sudo snap install fields
Build from source
The fields
command can be compiled by running
$ go get gophers.dev/cmds/fields/cmd/fields
Example Usages
select a single column (from left)
$ fields 3 <<< "a b c d e f g"
c
select a single column (from right)
$ fields -- -3 <<< "a b c d e f g"
e
select multiple columns
$ fields 1,-1,2,-2 <<< "a b c d e f g"
a g b f
select columns to the right of N (from left)
$ fields 4: <<< "a b c d e f g"
d e f g
select columns to the right of N (from right)
$ fields -- -2: <<< "a b c d e f g"
f g
select columns to the left of N (from left)
$ fields :2 <<< "a b c d e f g"
a b
select columns to the left of N (from right)
$ fields :-2 <<< "a b c d e f g"
a b c d e f
select range of columns
$ fields 2:5 <<< "a b c d e f g"
b c d e
any combination of the above, all together
$ fields 1,2,-2,3:5,2:,:-3 <<< "a b c d e f g"
a b f c d e b c d e f g a b c d e
Contributing
The gophers.dev/cmds/fields
module is always improving with new features
and error corrections. For contributing bug fixes and new features please file an issue.
License
The gophers.dev/cmds/fields
module is open source under the MIT license.