From 9bd8cdf2ecc2b60f873b393122b19985cbc4587c Mon Sep 17 00:00:00 2001 From: Jasper Ras Date: Mon, 2 Jun 2025 12:15:47 +0200 Subject: vault backup: 2025-06-02 12:15:47 --- A nice way to select IPv4 addresses with JQ.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 A nice way to select IPv4 addresses with JQ.md (limited to 'A nice way to select IPv4 addresses with JQ.md') 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 -- cgit v1.2.3