🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: chile.comp.programacion
Article #3259

Re: base de datos ip de cada pais

#3259
From: Leonardo Herrera
Date: Tue, 29 Mar 2005 15:15
23 lines
1880 bytes
Cristian Gutierrez wrote:
> Y si tienes Perl a mano, este one-liner hace todo el trabajo sucio:
> 
>   $ perl -nlpe '$n=0;s/(\d+)/join".",map{0xff&($1>>8*(3-$n++%4))}1..4/eg' \
>     < ip-to-country.csv
> 
> Eso, si es que no me pifie en algun lado... :-P

En todo caso:

	unpack('C4',pack('N',$packedip)

devuelve un array con cada elemento de $packedip. O sea,

   $ perl -nlpe 's/(\d+)/join".",unpack(C4,pack(N,$1))/eg'
     < ip-to-country.csv

es equivalente a tu ejemplo (si es que no me pifi� en alg�n lado... :-P)

Saludos,
--
Leonardo Herrera
http://leus.epublish.cl
Technical Details
Message-ID: <3at9hbF6f7hs3U1@individual.net>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news1.google.com!newsread.com!newsprint.newsread.com!63.218.45.11.MISMATCH!newshosting.com!nx02.iad01.newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!feed.news.tiscali.de!newsfeed01.sul.t-online.de!newsfeed00.sul.t-online.de!t-online.de!newsfeed2.orangenet.dk!newsfeed.orangenet.dk!newsfeed.simtel.ru!Simtel.RU!image.surnet.ru!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
References: <d29ghc$ej1$1@news1.nivel5.cl> <Xns9628E712E583patodonaldID6986628@200.73.8.4> <87k6nreyr1.fsf@guti.no-ip.org>

Show Full Headers
Complete Article Headers
X-Google-Thread: 1593cb,53e32211a6e3a92e
X-Google-Thread: fad43,53e32211a6e3a92e
X-Google-Attributes: gid1593cb,gidfad43,public
X-Google-Language: SPANISH,ASCII
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news1.google.com!newsread.com!newsprint.newsread.com!63.218.45.11.MISMATCH!newshosting.com!nx02.iad01.newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!feed.news.tiscali.de!newsfeed01.sul.t-online.de!newsfeed00.sul.t-online.de!t-online.de!newsfeed2.orangenet.dk!newsfeed.orangenet.dk!newsfeed.simtel.ru!Simtel.RU!image.surnet.ru!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: Leonardo Herrera <leus@epublish.cl>
Newsgroups: chile.comp.programacion,chile.comp.www
Subject: Re: base de datos ip de cada pais
Date: Tue, 29 Mar 2005 11:15:32 -0400
Lines: 23
Message-ID: <3at9hbF6f7hs3U1@individual.net>
References: <d29ghc$ej1$1@news1.nivel5.cl> <Xns9628E712E583patodonaldID6986628@200.73.8.4> <87k6nreyr1.fsf@guti.no-ip.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: individual.net h+x4luNJDF2vZCRDY0fQsw8cxZzK9OLFRunCjQ4yWxJTjw+4Ag
User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206)
X-Accept-Language: en-us, en
In-Reply-To: <87k6nreyr1.fsf@guti.no-ip.org>