On Tue, 17 Aug 2010, jonr@destar.net wrote:
> I'd hate to see the hard way.
:-)
perl -ane '$ip{$F[0]} .= join "", map { sprintf " %-10s", $_ }
@F[1 .. $#F]; END { foreach (sort
{ sprintf( "%03d.%03d.%03d.%03d", split /\./sm, $a ) cmp
sprintf( "%03d.%03d.%03d.%03d", split /\./sm, $b ) } keys %ip) {
printf "%-15s%s\n", $_, $ip{$_} }; };' /etc/hosts
This will columnize the hostnames (limiting each hostname to ten characters)
and printing out the list sorted by IP in numerical order by each octet.
--Arthur Corliss
Live Free or Die
---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Tue Aug 17 13:31:16 2010
This archive was generated by hypermail 2.1.8 : Tue Aug 17 2010 - 13:31:16 AKDT