diff options
Diffstat (limited to 'A nice way to select IPv4 addresses with JQ.md')
-rw-r--r-- | A nice way to select IPv4 addresses with JQ.md | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/A nice way to select IPv4 addresses with JQ.md b/A nice way to select IPv4 addresses with JQ.md new file mode 100644 index 0000000..b8f751d --- /dev/null +++ b/A nice way to select IPv4 addresses with JQ.md @@ -0,0 +1,12 @@ +--- +tags: + - jq + - howto +--- +Double escapes are important! + +``` +jq -r '.fixed_ips[] | select(.ip_address | test("([0-9]+\\.)+")) | .ip_address' +``` + +An example of constructing an array from stdin and filtering empty lines is found in [[Using JQ to construct an array and filtering empty strings]].
\ No newline at end of file |