yoones / csvql

Minimalist CSV query tool

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

csvql.rb

Minimalist CSV query tool

Syntax:

[index]  : Which field (starting from 1) to look in
operator : What check to do on this field
Operator Description
== numerical value must be equal to
!= numerical value must be different than
< numerical value must be less than
> numerical value must be greater than
<= numerical value must be less or equal to
>= numerical value must be greater or equal to
include: must contain the string
exclude: must not contain the string
match_line_in_file: Value must match any line in the file
doesnt_match_line_in_file: Value must not match any line in the file

Note that the first field's index is 1 (not 0).

Example:

./csvql.rb "[1]==toto" "[2]>=12" <<EOF
toto;2
titi;14
toto;12
EOF
This will output:
toto;12

Configuration:

-v : verbose mode
	 Displays step by step debug information in addition to matching lines
-q : quiet mode
	 Displays only matching lines

Another Example:

./csvql.rb -v "[1]>=12" "[2]include:HelloWorld!" "[4]match_line_in_file:/tmp/whitelist.txt"

About

Minimalist CSV query tool


Languages

Language:Ruby 100.0%