* Bengt Gördén
On 2022-03-17 18:11, Patrick Shanahan wrote:
this all but solves my need. I would also like to be able to drop the 4th quad and/or the 3rd and 4th.
I use this: $ cat ~/script/grepipnumber
#!/bin/sh
grep -E -o "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)"
Is that also possible?
Absolutely $ echo 1.1.1.1 | grepipnumber | awk -F. '{print $1"."$2}' 1.1
Often I need to append the net-part. Like so.
$ echo 1.1.1.1 | grepipnumber | awk -F. '{print $1"."$2"."$3".0/24"}' 1.1.1.0/24
tks, when I get matches for the first three quads, I ban 0/24. and from china for any I ban $1.$2.0/16 I figure legitimate china attempts will be via VPN. -- (paka)Patrick Shanahan Plainfield, Indiana, USA @ptilopteri http://en.opensuse.org openSUSE Community Member facebook/ptilopteri Photos: http://wahoo.no-ip.org/piwigo paka @ IRCnet oftc What sort of day was it? A day like all days, filled with those events that alter and illuminate our times...