#!/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

In reply to Re: Extracing (and excluding) IP's from a file by poolpi
in thread Extracing (and excluding) IP's from a file by sporesbash

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.