Created
September 1, 2025 19:22
-
-
Save simonneutert/f71a507d67142a2d59152f917bff9654 to your computer and use it in GitHub Desktop.
Revisions
-
simonneutert created this gist
Sep 1, 2025 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,6 @@ name;group;subgroup;type abc;1;a;x def;2;b;y ghi;3;c;z jkl;4;d;x mno;5;e;y This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,54 @@ # https://sq.io/docs/drivers/csv#delimiters sq add ./demo.csv --driver.csv.delim=semi --ingest.header # https://sq.io/docs/drivers/csv#monotable sq '@demo.data | .type | uniq' -j # [ # { # "type": "x" # }, # { # "type": "y" # }, # { # "type": "z" # } # ] sq '@demo.data | .type | uniq' -j | jq '{typ: [.[] | .type]}' # { # "typ": [ # "x", # "y", # "z" # ] # } sq sql 'SELECT distinct(type) from data' -j # [ # { # "type": "x" # }, # { # "type": "y" # }, # { # "type": "z" # } # ] sq sql 'SELECT distinct(type) from data' -j | jq '{typ: [.[] | .type]}' # { # "typ": [ # "x", # "y", # "z" # ] # } # write to a new csv sq sql 'SELECT distinct(type) from data' --csv --output=x.csv