Mailing List ArchiveSupport open source code!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]REGEXP in perl questiion
- To: tlug@example.com
- Subject: REGEXP in perl questiion
- From: "Jean-Christian Imbeault" <jean_christian@example.com>
- Date: Wed, 23 May 2001 08:44:31 -0000
- Content-Type: text/plain; format=flowed
- Reply-To: tlug@example.com
- Resent-From: tlug@example.com
- Resent-Message-ID: <dXcs7C.A.at.4h3C7@example.com>
- Resent-Sender: tlug-request@example.com
Ok, I admint it's lazy but could someone give me a regular expression in Perl that would do the following? (I've tried for the last hour but I'm not very good at regular expressions it seems). I have strings like the following: Subject: Cron <root@example.com> /root/AdminScripts/NSH.sh Subject: Cron <root@example.com> /usr/bin/rsync -avzr --delete /home/httpd/html/top40/* 10.0.1.53:/home/httpd/html/ I want to extract the name of the program that cron started, without the switches if any. I've tried this but it's greedy and doesn't extarct *just* the prog name but also the switches ... I tought the " .*?" would cause lazy expansion but it's not working as I had hoped. if ( $_ =~ /^Subject: /) { if ($_ =~ "Cron") { $CRON_EMAIL = 1; /^.*<.*> (/.*) *?.*$/; $PROGNAME = $1; print "The program called by cron was $PROGNAME\n"; } } _________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
- Follow-Ups:
- Re: REGEXP in perl questiion
- From: Matt Doughty <mdoughty@example.com>
- Re: REGEXP in perl questiion
- From: Matt Doughty <mdoughty@example.com>
- Re: REGEXP in perl questiion
- From: twistedhammer@example.com
Home | Main Index | Thread Index
- Prev by Date: 'atd' suddenly failing to start
- Next by Date: Re: REGEXP in perl questiion
- Prev by thread: Re: 'atd' suddenly failing to start
- Next by thread: Re: REGEXP in perl questiion
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links