Closed Whale-fall closed 2 years ago
Try this:
Variables formats:
$1 or ${1} The first field/column
$a or ${a} Column "a"
${a,b} or ${a b} or ${a (b)} Column name with special charactors,
e.g., commas, spaces, and parentheses
simple tests:
$ echo -ne "a\n1\n2\n" | ./csvtk filter2 -t -f '$a > 1'
a
2
$ echo -ne "a\n1\n2\n" | ./csvtk filter2 -t -f '${a} > 1'
a
2
$ echo -ne "a\n1\n2\n" | ./csvtk filter2 -t -f '$1 > 1'
a
2
$ echo -ne "a (b)\n1\n2\n" | csvtk filter2 -t -f '${1} > 1'
a (b)
2
$ echo -ne "a (b)\n1\n2\n" | csvtk filter2 -t -f '${a (b)} == 1'
a (b)
1
$ echo -ne "a,b\n1\n2\n" | ./csvtk filter2 -t -f '${a,b} > 1'
a,b
2
Thanks,It looks like a good idea
CSVTK version v0.23.0 raw file like this:
head vdjdb.slim.txt | cut -f 1,2,3,4,5
when I try to select rows by "antigen.gene" using filter2 an error appears
head vdjdb.slim.txt | cut -f 1,2,3,4,5 \\ | csvtk filter2 -t -f '$species == "HomoSapiens" && $antigen.gene=="Tat"'
Unable to parse numeric value '.' to float64