From 69bfb044f5d1fb3b492d6b0a5caebeaffc9991f7 Mon Sep 17 00:00:00 2001 From: Keith Irwin Date: Mon, 3 Oct 2022 11:20:04 -0600 Subject: [PATCH] Added line parsing --- back/lib/ips_to_peers_rxfr | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/back/lib/ips_to_peers_rxfr b/back/lib/ips_to_peers_rxfr index 75150ba..bf02c19 100755 --- a/back/lib/ips_to_peers_rxfr +++ b/back/lib/ips_to_peers_rxfr @@ -29,5 +29,12 @@ res="$("${LIB_DIR:?}/ns_lookup_rxfr")" || exit 4 # This should read from stdin while IFS= read -r line; do printf 'Checking line %s.\n' "${line}" - <<<"${res}" grep -B1 " ${line}" >>"${LOGFILE}" + pubkey="$(<<<"${line}" cut -d ' ' -f1)" + ips="$(<<<"${line}" cut -d ' ' -f2 | tr ' ' '\n')" + ipv4="$(<<<"${ips}" grep '\.')" + ipv6="$(<<<"${ips}" grep ':')" + ipv4="${ipv4%%/*}" + ipv6="${ipv6%%/*}" + <<<"${res}" grep -B1 " ${ipv4}" >>"${LOGFILE}" + <<<"${res}" grep -B1 " ${ipv6}" >>"${LOGFILE}" done