Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Extracing (and excluding) IP's from a file

by poolpi (Hermit)
on Nov 09, 2010 at 14:57 UTC ( [id://870318]=note: print w/replies, xml ) Need Help??


in reply to Extracing (and excluding) IP's from a file

#!/usr/bin/perl use strict; use warnings; use Regexp::Common qw /net/; $/ = ""; while (<DATA>){ next if /\A vfiler0 /x; /$RE{net}{IPv4}{-keep}/ and print $1, "\n"; } __DATA__ vfiler0 running ipspace: default-ipspace IP address: 10.42.156.16 [e0a] IP address: 10.42.156.19 [bae_test] IP address: 10.42.156.18 [e5a] Path: / [/etc] UUID: 00000000-0000-0000-0000-000000000000 vfiler1 running ipspace: default-ipspace IP address: 123.123.123.123 [unconfigured] Path: /vol/palermo [/etc] UUID: 4fa0d3d8-ecd6-11df-af94-00a09808463c vfilerbae running ipspace: default-ipspace IP address: 123.124.123.123 [unconfigured] Path: /vol/bae_testing [/etc] UUID: 605f7aa8-ecd6-11df-af94-00a09808463c

Output:
123.123.123.123
123.124.123.123


hth,
PooLpi

'Ebry haffa hoe hab im tik a bush'. Jamaican proverb

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://870318]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2024-03-28 22:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found