Answer the question
In order to leave comments, you need to log in
How to compare an IP address with a given mask?
How to compare in bash ip with a mask in my case so that ip has the address 192.168.10.*?
For example, the $ip variable is 192.168.10.5, not 127.0.0.1.
Answer the question
In order to leave comments, you need to log in
For debian there used to be such a utility www.pc-tools.net/unix/grepcidr
Maybe it will help.
Well, something like this, PATTERN for grep / egrep think out for your own conditions
[[email protected] ~]$ ip=192.168.10.5
[[email protected] ~]$ mask=192.168.10.[0-9]
[[email protected] ~]$ echo $ip | egrep $mask
192.168.10.5
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question