[22573] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 4794 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Mar 31 14:10:49 2003

Date: Mon, 31 Mar 2003 11:10:12 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 31 Mar 2003     Volume: 10 Number: 4794

Today's topics:
        piped commands <user@someserver123abc.com>
        Question : Regular expression to extract email from pfl (Arkis)
    Re: Question : Regular expression to extract email from <nobull@mail.com>
        question about activestate visual perl (Rut)
        Removing Brackets <alex@alexbanks.com>
    Re: Removing Brackets <nobull@mail.com>
        Replacing a string in a file <sbour@niaid.nih.gov>
    Re: seemingly simple problem <barryk2@SPAM-KILLER.mts.net>
    Re: seemingly simple problem <wksmith@optonline.net>
    Re: sort array of structs <me@verizon.invalid>
    Re: sort array of structs <me@verizon.invalid>
    Re: webhosts that support perl well? <ubl@schaffhausen.de>
    Re: webhosts that support perl well? <user@someserver123abc.com>
    Re: webhosts that support perl well? (Miko O'Sullivan)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Mon, 31 Mar 2003 11:36:18 -0500
From: stinkbomb <user@someserver123abc.com>
Subject: piped commands
Message-Id: <3E886E82.CBDAF865@someserver123abc.com>

can this be piped like a unix command?
that is, in unix, you can:
cat file|grep "hello"|grep "world"|more

can I pipe this in perl:
$x =~ s/hello/goodbye/gi;

what if I want to pattern match, pipe, another pattern:
$x =~ s/hello/goodbye/gi  |PIPE_RESULT| s/world/planet/gi
|PIPE_IT_AGAIN| s/!/\?/gi;
 ...and again...and again.....

is that possible or is it a pipe dream?


-----------== Posted via Newsfeed.Com - Uncensored Usenet News ==----------
   http://www.newsfeed.com       The #1 Newsgroup Service in the World!
-----= Over 100,000 Newsgroups - Unlimited Fast Downloads - 19 Servers =-----


------------------------------

Date: 31 Mar 2003 08:55:10 -0800
From: cedric@voxtel.com (Arkis)
Subject: Question : Regular expression to extract email from pflogsumm
Message-Id: <251befe5.0303310855.25f29e1e@posting.google.com>

Hello all,

I'd like to extract email adresses from a pflogsumm log file and put
them in a array in Perl.

The log file format is like this :

  mail.dom.com[IP]
         1   5.1.1 unknown or illegal alias: adr1@dom1.com
         1   5.1.1 unknown or illegal alias: adr2@dom1.com
  mail2.dom.dom[IP]
         1   <adr3@dom2.com>: User unknown
         1   <adr4@dom2.com>: User unknown
  mail3.dom.com[IP] 
         1   This account is not allowed...adr5@dom3.com
         1   This account is not allowed...adr6@dom3.com
         1   This account is not allowed...adr7@dom3.com

I want to build an array that would contain only the email adresses.
The main problem is that there could have several caracters (like ...)
before the email adresses.

I tried several scripts but without good results.

Help would be appreciated !!

Thanks,

Cedric


------------------------------

Date: 31 Mar 2003 19:09:07 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: Question : Regular expression to extract email from pflogsumm
Message-Id: <u9znnbs918.fsf@wcl-l.bham.ac.uk>

cedric@voxtel.com (Arkis) writes:

> I'd like to extract email adresses from a pflogsumm log file and put
> them in a array in Perl.

> The log file format is like this :
> 
>   mail.dom.com[IP]
>          1   5.1.1 unknown or illegal alias: adr1@dom1.com
>          1   5.1.1 unknown or illegal alias: adr2@dom1.com
>   mail2.dom.dom[IP]
>          1   <adr3@dom2.com>: User unknown
>          1   <adr4@dom2.com>: User unknown
>   mail3.dom.com[IP] 
>          1   This account is not allowed...adr5@dom3.com
>          1   This account is not allowed...adr6@dom3.com
>          1   This account is not allowed...adr7@dom3.com
> 
> I want to build an array that would contain only the email adresses.
> The main problem is that there could have several caracters (like ...)
> before the email adresses.

Well <allowed...adr7@dom3.com> is a perfectly valid e-mail address so
there is absolutely know way of knowing if the address is supposed to
be <allowed...adr7@dom3.com> or <adr7@dom3.com> without recognising
the message format.

The only real solution is to know all the exact structure of all
pflogsumm messages that could contain an email address.

> I tried several scripts but without good results.

I think you probably jumped to the step of trying to implement a
soluion without understand your problem first.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


------------------------------

Date: 31 Mar 2003 08:19:12 -0800
From: rutledj@rjrt.com (Rut)
Subject: question about activestate visual perl
Message-Id: <d88f2c7d.0303310819.1540cf74@posting.google.com>

This is really more of a .net question I guess but....

Is there an easy way to call/launch a perl script from within vb.net?

Thanks,
Rut


------------------------------

Date: Mon, 31 Mar 2003 18:27:36 +0100
From: "Alex Banks" <alex@alexbanks.com>
Subject: Removing Brackets
Message-Id: <3e887a8d$0$4846$cc9e4d1f@news.dial.pipex.com>

I need to remove matching brackets and everything between them from a
string... For example:

$temp = "select a.alex, concat(b.firstname, ' ', b.lastname) as name,
concat('(0', substring(c.number from 3 for 5), ') ', substring(c.number from
7)) as number from tba a, tbb b, tbc c";

 ...after the processing $temp should be...

"select a.alex, concat as name, concat as number from tba a, tbb b, tbc c"

Anyone have a good solution for this?

Many Thanks,


Alex




------------------------------

Date: 31 Mar 2003 19:03:44 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: Removing Brackets
Message-Id: <u94r5jtnun.fsf@wcl-l.bham.ac.uk>

"Alex Banks" <alex@alexbanks.com> writes:

> I need to remove matching brackets and everything between them from a
> string...

This is FAQ: "How do I find matching/nesting anything?"

Please consult the FAQ before posting.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


------------------------------

Date: Mon, 31 Mar 2003 13:48:24 -0500
From: Stephan Bour <sbour@niaid.nih.gov>
Subject: Replacing a string in a file
Message-Id: <BAADF7A8.6B8C%sbour@niaid.nih.gov>

I'm having difficulties understanding file manipulation and I hope someone
can help me.
I'm trying to modify the text inside a hostfile and change the
DNSSERVER=-NO- entry to DNSSERVER=-YES-.
The code below works fine when I provide the string but I get a bunch of
errors when I try to do the same thing on a copy of the hostfile itself.
Could someone point me in the right direction as to how to load a file to
modify it and have it saved with the new entry? Should I load the entire
file in an array or use a while statement looking at each line one by one?
I'm using the +< operator when opening the file, is this correct?

#!usr/bin/perl

$text = "Find the line DNSSERVER=-NO- and change it to DNSSERVER=-YES-";
print "text is: $text\n";
while ($text =~ s/DNSSERVER=-NO-/DNSSERVER=-YES-/){
print "The string is now $text\n";
}



------------------------------

Date: Mon, 31 Mar 2003 08:21:34 -0600
From: Barry Kimelman <barryk2@SPAM-KILLER.mts.net>
Subject: Re: seemingly simple problem
Message-Id: <MPG.18f20ae8b2cccc8d989778@news.mts.net>

[This followup was posted to comp.lang.perl.misc]

In article <5d736387.0303301217.529e5dba@posting.google.com>, Jan Snajder 
(jsnajder@inet.hr) says...
> Hi!,
> I am new to Perl, to this will be a silly question for most of you
> guys.
> 
> I need a script that will convert all pathnames contained within a
> file into pathnames with uppercase.
> 
> For example, a line within a file containing 
> "blah blah ../../Installer/SystemFiles blah blah" shall be converted
> to
> "blah blah ../../INSTALLER/SYSTEMFILES blah blah".
> 
> I've just spent 3 hours trying to figure out how to do it...
> It seems so simple :)
> 
> thanx,
> jan
> 

$pathname = uc $pathname;  # convert to uppercase


-- 
---------

Barry Kimelman
Winnipeg, Manitoba, Canada
email : bkimelman@hotmail.com


------------------------------

Date: Mon, 31 Mar 2003 15:49:55 GMT
From: "Bill Smith" <wksmith@optonline.net>
Subject: Re: seemingly simple problem
Message-Id: <DsZha.3792$%U1.1868054@news4.srv.hcvlny.cv.net>


"Abigail" <abigail@abigail.nl> wrote in message
news:slrnb8g3bk.ts6.abigail@alexandra.abigail.nl...
> Bill Smith (wksmith@optonline.net) wrote on MMMCDXCIX September
MCMXCIII
> in <URL:news:L3Qha.815$%U1.373897@news4.srv.hcvlny.cv.net>:
> ::
> ::   s!(/[\w/.]+)!uc($1)!e;
>
>      s!(/[\w/.]+)!\U$1!g;
>
>
>
> Abigail
> --

Neat! And I did forget the /g.

Thanks,
Bill




------------------------------

Date: Mon, 31 Mar 2003 15:54:57 GMT
From: "dw" <me@verizon.invalid>
Subject: Re: sort array of structs
Message-Id: <lxZha.27476$HR6.21304@nwrdny01.gnilink.net>


"vervoom" <vervoom@hotmail.com> wrote in message
news:b69ctp$jkm$1@cspc1n11.baplc.com...
> vervoom wrote:
> >
> > struct Mail =>
> >     [
> >         qkey    => 'qidKey',
> >         msgid   => '$',
> >         client  => '$',
> >         from    => '$',
> >         to      => '@',
> >         size    => '$',
> >         month   => '$',
> >         day     => '$',
> >         time    => '$',
> >         localqids => '@'
> >     ];
> >
> > struct qidKey =>
> >     [
> >         host    => '$',
> >         qid     => '$',
> >     ];
> >
> > foreach $nmail (sort $mail->qkey->host($a) <=> $mail->qkey->host($b) )
> > @maillist{
> >
> > but I'm getting nowhere. Would appreciate any help you can give me.
> >
>
> Does this look right?
>
> @maillist=sort {$a->qkey->qid <=> $b->qkey->qid && $a->qkey->host <=>
> $b->qkey->host } @maillist;
>

This looks better, but change the && to a || in the middle:
@maillist=sort {$a->qkey->qid <=> $b->qkey->qid
                              ||
                $a->qkey->host <=> $b->qkey->host } @maillist;




------------------------------

Date: Mon, 31 Mar 2003 16:07:52 GMT
From: "dw" <me@verizon.invalid>
Subject: Re: sort array of structs
Message-Id: <sJZha.27618$HR6.22476@nwrdny01.gnilink.net>


"dw" <me@verizon.invalid> wrote in message
news:lxZha.27476$HR6.21304@nwrdny01.gnilink.net...
>
> "vervoom" <vervoom@hotmail.com> wrote in message
> news:b69ctp$jkm$1@cspc1n11.baplc.com...
> > vervoom wrote:
> > >
>
> This looks better, but change the && to a || in the middle:
> @maillist=sort {$a->qkey->qid <=> $b->qkey->qid
>                               ||
>                 $a->qkey->host <=> $b->qkey->host } @maillist;
>

Of course, I would guess that host is probably alphanumeric so you would
need the last <=> to be cmp instead.

dw




------------------------------

Date: Mon, 31 Mar 2003 16:37:34 +0200
From: Malte Ubl <ubl@schaffhausen.de>
Subject: Re: webhosts that support perl well?
Message-Id: <b69n1c$cvr$1@news.dtag.de>

dan baker wrote:
> I realize this is not a *pure* perl question..... but I'm looking for
> some feedback from perl programmers who may have found some reasonable
> web hosts that do a good job supporting sites with custom scripts.
> 
> The host I've been using a lot for the last couple years has been
> having increasing trouble with *growing pains* and service has fallen
> by the wayside. They recently suffered some attacks from hackers and
> one server has been down for 48 hours now with domains dead in the
> water; no mirror, no backups, etc.
> 
> anyway, if anyone has a couple hosts they like to use, that support
> custom perl scripts in user cgi-bin, and hopefully other common
> features like .htaccess for specific password protection, please post
> their URL so I can go check them out....

I'm not a customer myself, but Pair Networks have been a very large 
contributor to the Perl community, both in terms of money and free hosting:
http://www.pair.com/

Bye,
->malte



------------------------------

Date: Mon, 31 Mar 2003 11:46:30 -0500
From: stinkbomb <user@someserver123abc.com>
Subject: Re: webhosts that support perl well?
Message-Id: <3E8870E6.A286C14C@someserver123abc.com>

these two have been good to me:
www.panix.com
www.cloud9.net

dan baker wrote:
> 
> I realize this is not a *pure* perl question..... but I'm looking for
> some feedback from perl programmers who may have found some reasonable
> web hosts that do a good job supporting sites with custom scripts.
> 
> The host I've been using a lot for the last couple years has been
> having increasing trouble with *growing pains* and service has fallen
> by the wayside. They recently suffered some attacks from hackers and
> one server has been down for 48 hours now with domains dead in the
> water; no mirror, no backups, etc.
> 
> anyway, if anyone has a couple hosts they like to use, that support
> custom perl scripts in user cgi-bin, and hopefully other common
> features like .htaccess for specific password protection, please post
> their URL so I can go check them out....
> 
> mucho gracias,
> 
> D


-----------== Posted via Newsfeed.Com - Uncensored Usenet News ==----------
   http://www.newsfeed.com       The #1 Newsgroup Service in the World!
-----= Over 100,000 Newsgroups - Unlimited Fast Downloads - 19 Servers =-----


------------------------------

Date: 31 Mar 2003 10:47:46 -0800
From: miko@idocs.com (Miko O'Sullivan)
Subject: Re: webhosts that support perl well?
Message-Id: <db27ea77.0303311047.2ab42005@posting.google.com>

botfood@yahoo.com (dan baker) wrote in message ...
> I realize this is not a *pure* perl question..... but I'm looking for
> some feedback from perl programmers who may have found some reasonable
> web hosts that do a good job supporting sites with custom scripts.

I'm totally happy with my current web host provider:
http://www.ninthwonder.com. Ninth Wonder is run by my friend Allen
Briggs, an expert in BSD. NinthWonder's main sales point is that they
provide all the open source goodies that an experienced web developer
needs, then lets you do your own thing.  It's like renting a
wood-shop: you get your table saw, your planers, your drills, etc, and
then you're left on your own to create as you wish.

-Miko


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 4794
***************************************


home help back first fref pref prev next nref lref last post