informatique:jq
Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
informatique:jq [03/10/2021 12:48] – [Play with js] cyrille | informatique:jq [04/10/2021 08:40] (Version actuelle) – [jq] cyrille | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
====== jq ====== | ====== jq ====== | ||
- | [[https:// | + | **[[https://stedolan.github.io/jq/|jq]]** a lightweight and flexible command-line JSON processor. |
+ | * Le [[https:// | ||
* La [[https:// | * La [[https:// | ||
* Le [[https:// | * Le [[https:// | ||
Ligne 14: | Ligne 15: | ||
- | ===== Play with js ===== | + | ===== Play with jq ===== |
'' | '' | ||
Ligne 51: | Ligne 52: | ||
</ | </ | ||
- | ==== Howto count occurrence of " | + | ==== Howto count occurrence of " |
- | No need to use '' | + | https:// |
- | < | + | === Sans group_by === |
+ | |||
+ | < | ||
jq '" | jq '" | ||
id: .member_id, | id: .member_id, | ||
Ligne 75: | Ligne 78: | ||
</ | </ | ||
+ | === Avec group_by === | ||
+ | |||
+ | <code bash> | ||
+ | jq 'map( | ||
+ | | ||
+ | | .loans[].media[] | ||
+ | | select(.title==" | ||
+ | | {id: $m, title: .title} | ||
+ | ) | ||
+ | |group_by(.id)[] | ||
+ | |.[0] + { count: length } | ||
+ | ' members.json | ||
+ | </ | ||
informatique/jq.1633258096.txt.gz · Dernière modification : 03/10/2021 12:48 de cyrille