On Nov 23, Dermot Paikkos said:
Looking at the mail queue on my smtp server I notice the usual amount
of crap. The mailq output is in this format:
11h 8.5K 1EeoEz-0003t2-00 <>
[EMAIL PROTECTED]
10h 10K 1EepGl-0004VH-00 <>
[EMAIL PROTECTED]
11h 8.4K 1EeoUI-0004YR-00 <>
[EMAIL PROTECTED]
In case the formatting doesn't make it, that's a newline after '<>'
and a newlines between each (two-line) record.
Well, if you read the file one line at a time, you'll never have BOTH a
message-ID AND an email address in a string at the same time. You'll need
to alter your input record seperator:
local $/ = ""; # matches on 2 or more newlines in a row
Or, from the command-line:
perl -00 ...
mailq | perl -e 'while (<>) {print $1, "\n" if /([\d+|\w+]-[\d+|\w+]-
00).*porn/m }'
Your regexes are funky. First of all, [...] is for CHARACTERS. [\d+|\w+]
is the same as [\d\w|+] which is the same as [\w|+] anyway, since \w
includes \d.
So you could do:
perl -00 -ane 'print $F[2] if $F[4] =~ /porn/' ...
The -a switch autosplits $_ into @F on whitespace.
--
Jeff "japhy" Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://www.perlmonks.org/ % have long ago been overpaid?
http://princeton.pm.org/ % -- Meister Eckhart
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>