mirror of
https://github.com/ivuorinen/cheatsheet-tldr.git
synced 2026-02-13 02:47:59 +00:00
Update cheatsheets
This commit is contained in:
12
tldr/jq
12
tldr/jq
@@ -8,10 +8,6 @@ source: https://github.com/tldr-pages/tldr.git
|
||||
> A JSON processor that uses a domain-specific language (DSL).
|
||||
> More information: <https://jqlang.github.io/jq/manual/>.
|
||||
|
||||
- Execute a specific expression (print a colored and formatted JSON output):
|
||||
|
||||
`{{cat path/to/file.json}} | jq '.'`
|
||||
|
||||
- Execute a specific expression only using the `jq` binary (print a colored and formatted JSON output):
|
||||
|
||||
`jq '.' {{/path/to/file.json}}`
|
||||
@@ -24,9 +20,9 @@ source: https://github.com/tldr-pages/tldr.git
|
||||
|
||||
`{{cat path/to/file.json}} | jq {{--arg "name1" "value1" --arg "name2" "value2" ...}} '{{. + $ARGS.named}}'`
|
||||
|
||||
- Print specific keys:
|
||||
- Create new JSON object via old JSON objects from multiple files:
|
||||
|
||||
`{{cat path/to/file.json}} | jq '{{.key1, .key2, ...}}'`
|
||||
`{{cat path/to/multiple_json_file_*.json}} | jq '{{{newKey1: .key1, newKey2: .key2.nestedKey, ...}}}'`
|
||||
|
||||
- Print specific array items:
|
||||
|
||||
@@ -36,6 +32,10 @@ source: https://github.com/tldr-pages/tldr.git
|
||||
|
||||
`{{cat path/to/file.json}} | jq '.[]'`
|
||||
|
||||
- Print objects with 2-condition filter in array:
|
||||
|
||||
`{{cat path/to/file.json}} | jq '.[] | select((.key1=="value1") and .key2=="value2")'`
|
||||
|
||||
- Add/remove specific keys:
|
||||
|
||||
`{{cat path/to/file.json}} | jq '. {{+|-}} {{{"key1": "value1", "key2": "value2", ...}}}'`
|
||||
|
||||
Reference in New Issue
Block a user