On Aug 23, 2004, at 2:31 PM, Dave Kettmann wrote:

Ok ... I'm going to try to confuse everyone again because either a) I'm dense or b) I'm asking the wrong question. Everyone can agree with option a, and I will not get mad :). Ok .. here goes again...

For future reference, we prefer you submit your attempts to code up a solution, which we will then help fix. Make us feel like we aren't doing all the work. ;)


I looked at s2p and it spit out 2 pages of perl code of which the sed command was a small bit of code. It is nothing major that I want to do an example is below:

I'm unfamiliar with the program, but I have to say, "Yuck."

I want this ...:

Aug 23 14:28:32 Auth.notice: (Access-Request 10.10.116.4 166 "000611-011c0c"): Login OK [000611-011c0c]

To be this ...:
Aug 23 14:25:32 (Access-Request 10.10.116.4 166 "000611-011c0c"): Login OK


Or to make it easier, I want to take out the 'Auth.notice: ' and anything encased in []'s.

Here's one simple way you might accomplish that in Perl:

#!/usr/bin/perl

use strict;
use warnings;

my $text = 'Aug 23 14:28:32 Auth.notice: (Access-Request 10.10.116.4 166 "000611-011c0c"): Login OK [000611-011c0c]';

$text =~ s/Auth\.notice://;
$text =~ s/\[[^]]+\]//;

print "$text\n";

__END__

Hope that helps.

James


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to