[aklug] Re: perl lists question, sorting, sort of.

From: <jonr@destar.net>
Date: Tue Aug 17 2010 - 13:12:05 AKDT

Quoting Arthur Corliss <acorliss@nevaeh-linux.org>:

> On Tue, 17 Aug 2010, Arthur Corliss wrote:
>
>> perl -ane '$ip{$F[0]} .= " $F[1]"; END { foreach (keys %ip) {
>> print "$_ $ip{$_}\n" }; };' /etc/hosts
>
> It occurred to me that you might already have a few lines in your hosts file
> with multiple names on one line. The following alternative will preserve
> those extra host names as well:
>
> perl -ane '$ip{$F[0]} = join " ", $ip{$F[0]}, @F[1 .. $#F];
> END { foreach (keys %ip) { print "$_ $ip{$_}\n" }; };'
>
> --Arthur Corliss
> Live Free or Die

I'd hate to see the hard way.

---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Tue Aug 17 13:18:22 2010

This archive was generated by hypermail 2.1.8 : Tue Aug 17 2010 - 13:18:22 AKDT