A slightly different approach so as to replace each digit of the masked octets with an 'x' rather than the whole octet with a single 'X' just as an exercise.
$ perl -Mstrict -Mwarnings -E ' open my $inFH, q{<}, \ <<EOD or die $!; 10.128.99.190 10.128.100.100 1.1.1.1 2.2.2.2 3.3.3.3 4.4.4.4 100.100.100.100 200.200.200.200 EOD print for map { s{ (\d+\.\d+) (?= (?:\.\d+){2} ) } { do{ my $c = $1; $c =~ tr{0-9}{x}; $c } }xeg; $_; } <$inFH>;' xx.xxx.99.190 xx.xxx.100.100 x.x.1.1 x.x.2.2 x.x.3.3 x.x.4.4 xxx.xxx.100.100 xxx.xxx.200.200 $
I hope this is of interest.
Cheers,
JohnGG
In reply to Re: Patternmatching IPaddresses
by johngg
in thread Patternmatching IPaddresses
by vyeddula
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |