in reply to ip sorting
Ok, but I'd like to see what your try was (untested code follows).
That will need perl 5.6+ to handle lexical filehandles and 3-arg open. Minor adjustment to run on older versions.#!/usr/bin/perl use warnings; use strict; use Socket qw( inet_aton inet_ntoa); # takes file paths as argument for (@ARGV) { local $, = $/; open my $fh, '<', $_ or die $!; print map { inet_ntoa($_) } sort { $a <=> $b } map { chomp; inet_aton($_) } <$fh>; print $/; close $fh or die $!; }
Update: pg++, thanks for catching my error. I'll leave this as it is, see pg's reply below.
After Compline,
Zaxo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: ip sorting
by pg (Canon) on Mar 21, 2003 at 04:35 UTC | |
by Anonymous Monk on Mar 24, 2003 at 00:06 UTC | |
|
Re: Re: ip sorting
by Anonymous Monk on Mar 20, 2003 at 23:57 UTC |