Last active
April 18, 2025 13:21
-
-
Save Reino17/a9d8449ad2a05dccb71767425e93ec0a to your computer and use it in GitHub Desktop.
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 characters
| $ xidel -s "so_24300508.csv" -e '$raw' | |
| Africa,Kenya,NAI,109 | |
| Africa,Kenya,NAA,160 | |
| Asia,India,NSI,100 | |
| Asia,India,BSE,60 | |
| Asia,Pakistan,ISE,120 | |
| Asia,Pakistan,ANO,433 | |
| European Union,United Kingdom,LSE,550 | |
| European Union,United Kingdom,PLU,123 | |
| $ xidel -s "so_24300508.csv" -e 'x:lines($raw) ! array{tokenize(.,",")}' | |
| ["Africa", "Kenya", "NAI", "109"] | |
| ["Africa", "Kenya", "NAA", "160"] | |
| ["Asia", "India", "NSI", "100"] | |
| ["Asia", "India", "BSE", "60"] | |
| ["Asia", "Pakistan", "ISE", "120"] | |
| ["Asia", "Pakistan", "ANO", "433"] | |
| ["European Union", "United Kingdom", "LSE", "550"] | |
| ["European Union", "United Kingdom", "PLU", "123"] | |
| $ xidel -s "so_24300508.csv" -e 'let $csv:=x:lines($raw) ! array{tokenize(.,",")} return distinct-values($csv(1))' | |
| Africa | |
| Asia | |
| European Union | |
| $ xidel -s "so_24300508.csv" -e ' | |
| array{ | |
| let $csv:=x:lines($raw) ! array{tokenize(.,",")} | |
| for $region in distinct-values($csv(1)) | |
| return { | |
| "name":$region, | |
| "children":array{$csv[.() = $region] ! array:tail(.)} | |
| } | |
| } | |
| ' | |
| [ | |
| { | |
| "name": "Africa", | |
| "children": [ | |
| ["Kenya", "NAI", "109"], | |
| ["Kenya", "NAA", "160"] | |
| ] | |
| }, | |
| { | |
| "name": "Asia", | |
| "children": [ | |
| ["India", "NSI", "100"], | |
| ["India", "BSE", "60"], | |
| ["Pakistan", "ISE", "120"], | |
| ["Pakistan", "ANO", "433"] | |
| ] | |
| }, | |
| { | |
| "name": "European Union", | |
| "children": [ | |
| ["United Kingdom", "LSE", "550"], | |
| ["United Kingdom", "PLU", "123"] | |
| ] | |
| } | |
| ] | |
| $ xidel -s "so_24300508.csv" -e ' | |
| let $csv:=x:lines($raw) ! array{tokenize(.,",")} | |
| for $region in distinct-values($csv(1)) | |
| return | |
| distinct-values($csv[.() = $region](2)) | |
| ' | |
| Kenya | |
| India | |
| Pakistan | |
| United Kingdom | |
| $ xidel -s "so_24300508.csv" -e ' | |
| array{ | |
| let $csv:=x:lines($raw) ! array{tokenize(.,",")} | |
| for $region in distinct-values($csv(1)) | |
| return { | |
| "name":$region, | |
| "children":array{ | |
| for $country in distinct-values($csv[.() = $region](2)) | |
| return { | |
| "name":$country, | |
| "children":array{$csv[.() = ($country)] ! array:subarray(.,3)} | |
| } | |
| } | |
| } | |
| } | |
| ' | |
| [ | |
| { | |
| "name": "Africa", | |
| "children": [ | |
| { | |
| "name": "Kenya", | |
| "children": [ | |
| ["NAI", "109"], | |
| ["NAA", "160"] | |
| ] | |
| } | |
| ] | |
| }, | |
| { | |
| "name": "Asia", | |
| "children": [ | |
| { | |
| "name": "India", | |
| "children": [ | |
| ["NSI", "100"], | |
| ["BSE", "60"] | |
| ] | |
| }, | |
| { | |
| "name": "Pakistan", | |
| "children": [ | |
| ["ISE", "120"], | |
| ["ANO", "433"] | |
| ] | |
| } | |
| ] | |
| }, | |
| { | |
| "name": "European Union", | |
| "children": [ | |
| { | |
| "name": "United Kingdom", | |
| "children": [ | |
| ["LSE", "550"], | |
| ["PLU", "123"] | |
| ] | |
| } | |
| ] | |
| } | |
| ] | |
| $ xidel -s "so_24300508.csv" -e ' | |
| array{ | |
| let $csv:=x:lines($raw) ! array{tokenize(.,",")} | |
| for $region in distinct-values($csv(1)) | |
| return { | |
| "name":$region, | |
| "children":array{ | |
| for $country in distinct-values($csv[.() = $region](2)) | |
| return { | |
| "name":$country, | |
| "children":array{ | |
| $csv[.() = ($country)] ! { | |
| "name":.(3), | |
| "size":.(4) | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| ' | |
| [ | |
| { | |
| "name": "Africa", | |
| "children": [ | |
| { | |
| "name": "Kenya", | |
| "children": [ | |
| { | |
| "name": "NAI", | |
| "size": "109" | |
| }, | |
| { | |
| "name": "NAA", | |
| "size": "160" | |
| } | |
| ] | |
| } | |
| ] | |
| }, | |
| { | |
| "name": "Asia", | |
| "children": [ | |
| { | |
| "name": "India", | |
| "children": [ | |
| { | |
| "name": "NSI", | |
| "size": "100" | |
| }, | |
| { | |
| "name": "BSE", | |
| "size": "60" | |
| } | |
| ] | |
| }, | |
| { | |
| "name": "Pakistan", | |
| "children": [ | |
| { | |
| "name": "ISE", | |
| "size": "120" | |
| }, | |
| { | |
| "name": "ANO", | |
| "size": "433" | |
| } | |
| ] | |
| } | |
| ] | |
| }, | |
| { | |
| "name": "European Union", | |
| "children": [ | |
| { | |
| "name": "United Kingdom", | |
| "children": [ | |
| { | |
| "name": "LSE", | |
| "size": "550" | |
| }, | |
| { | |
| "name": "PLU", | |
| "size": "123" | |
| } | |
| ] | |
| } | |
| ] | |
| } | |
| ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment