Re: Why archives are hanging ... - Mailing list pgsql-www

From Marc G. Fournier
Subject Re: Why archives are hanging ...
Date
Msg-id 20051230145103.F1088@ganymede.hub.org
Whole thread Raw
In response to Re: Why archives are hanging ...  (Michael Fuhr <mike@fuhr.org>)
List pgsql-www
On Fri, 30 Dec 2005, Michael Fuhr wrote:

> On Fri, Dec 30, 2005 at 10:54:57AM -0400, Marc G. Fournier wrote:
>> Here is the cause:
>>
>> root    66170 96.2  0.1  2316  792  ??  RJ    6:59AM 430:11.37 perl -e
>> $i=<STDIN>;print substr($i,0,4) . "-" . substr($i,4,2); (perl5.8.7)
>>
>> Specifically, in my script:
>>
>>     set fdate = `echo $j | \
>>                  awk -F. '{print $4}' | \
>>                  perl -e '$i=<STDIN>;print substr($i,0,4) . "-" .
>>                  substr($i,4,2);'`
>>
>>
>> Where $j would be equal to something like:
>>
>> /usr/local/www/archives.postgresql.org/majordomo/pgsql-hackers/files/public/archive/pgsql-hackers.200512
>>
>> Can someone suggest a cleaner way of doing this?  Specifically, I'm just
>> converting the last part (200512) to 2005-12 ...
>
> As for a cleaner way, there's no need to use both awk and perl since
> either can do the whole job.  Here are some possibilities:
>
> awk -F. '{print substr($4,1,4) "-" substr($4,5,2)}'

Perfect, awk was one of those that I never got anywhere far with, and
muddled through when I did :(

> As for why the existing command is sucking up CPU time, I can't think of
> why it would be.  Have you done a process trace?  You probably won't see
> anything if it's not making any system calls but it might be worth
> checking out.

Actually, it only does it semi-randomly, it doesn't do it every time ...
:(  Have taken out the perl and just using awk now, so we'll see how it
runs ...

Thanks ...

----
Marc G. Fournier           Hub.Org Networking Services (http://www.hub.org)
Email: scrappy@hub.org           Yahoo!: yscrappy              ICQ: 7615664

pgsql-www by date:

Previous
From: Michael Fuhr
Date:
Subject: Re: Why archives are hanging ...
Next
From: Devrim GUNDUZ
Date:
Subject: Re: Initial Upgrade of PgFoundry completed