linux:jq
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
linux:jq [20/02/2024 17:01] – created - external edit 127.0.0.1 | linux:jq [12/02/2025 11:30] (current) – [Extracting multiple values in one pass] andrew | ||
---|---|---|---|
Line 57: | Line 57: | ||
SecretSession== | SecretSession== | ||
</ | </ | ||
+ | |||
+ | |||
+ | ====== Extracting multiple values in one pass ====== | ||
+ | |||
+ | Use a comma to separate multiple fields to extract:- | ||
+ | |||
+ | Raw outpput for NAT gateways | ||
+ | <code json> | ||
+ | $ aws ec2 describe-nat-gateways | ||
+ | { | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | ], | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | ], | ||
+ | " | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Code to extract just NAT id, state and Elastic ip in use:- | ||
+ | <code bash> | ||
+ | $ aws ec2 describe-nat-gateways | jq " | ||
+ | |||
+ | " | ||
+ | " | ||
+ | " | ||
+ | $ | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
linux/jq.1708448465.txt.gz · Last modified: by 127.0.0.1