Skip to content

Latest commit

 

History

History
51 lines (40 loc) · 1.15 KB

grep.md

File metadata and controls

51 lines (40 loc) · 1.15 KB

uxy grep

Field-based grep.

If one argument is given it searches for the supplied regular expression in any fields of the UXY input.

$ uxy grep Moby < test.uxy

If two arguments are given it searches for the pattern in the specified field.

$ uxy grep Moby NAME < test.uxy

If many arguments are given they are treated as pairs of regular expressions and field names. If there's an odd number of arguments the last one is matched against all the fields.

$ uxy grep "^Moby.*$" NAME whale SPECIES < test.uxy

Note that the pattern matching works on decoded field values, not on the UXY formatting of the fields. For example, if there is a field with value "A B" it would be matched by regular expression A but not by \"A.

Example

$ cat test.uxy
NAME     SIZE 
README.md 8060 
test.csv 45
test.uxy 0
uxy      13458 
$ cat test.uxy | uxy grep csv
NAME     SIZE 
test.csv 45
$ cat test.uxy | uxy grep csv NAME
NAME     SIZE 
test.csv 45
$ cat test.uxy | uxy grep csv SIZE
NAME     SIZE
$ cat test.uxy | uxy grep test NAME 45 SIZE
NAME     SIZE 
test.csv 45