summaryrefslogtreecommitdiff
path: root/A nice way to select IPv4 addresses with JQ.md
diff options
context:
space:
mode:
authorJasper Ras <jras@hostnet.nl>2025-06-02 12:15:47 +0200
committerJasper Ras <jras@hostnet.nl>2025-06-02 12:17:02 +0200
commit9bd8cdf2ecc2b60f873b393122b19985cbc4587c (patch)
treea4e0ad7e2824e24b187525fc3c51f8d382d1aceb /A nice way to select IPv4 addresses with JQ.md
parenta61d928b279c5c508aca3bfc7cb14d810c3d75de (diff)
vault backup: 2025-06-02 12:15:47
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.md12
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