Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

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

by poolpi (Hermit)
on Nov 09, 2010 at 14:57 UTC ( #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


Comment on Re: Extracing (and excluding) IP's from a file
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2015-07-03 23:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (57 votes), past polls