Charlie Farinella wrote at Wed, 03 Jul 2002 23:51:44 +0200: > I have the following script that prints email addresses enclosed in <> from a >logfile. It works > by removing everything up to and including the bracket on the left, and then doing >the same on the > right. I would like to be able to just extract the text between the brackets. > > I have been unable to figure out how to do this and am hoping for some help. > > =============================== > #!/usr/local/bin/perl -w > > # Read through the maillog, and print out the email # addresses. (<email.address>) > > open (INFILE, "<$ARGV[0]" ); > > while (<INFILE>) { > > if( $_ =~ /<.*>/i ) { > $_ =~ s/^.*<//g; > $_ =~ s/>.*$//g; > print $_; > } > } > } > close INFILE; >
while (<INFILE>) { /<(.*?)>/ and print $1; } Best Wishes, Janek -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]