*WARNING* Newbie alert! ;-)
There's probably much better regexs than what I've done here, and I put
them together before you posted this data (and maybe they don't always
do what I've said; Enough qualification? :-O ) but here's my go at it
#!/usr/bin/perl -wT
use strict;
my @log_entries = ('"some text" 106',
'my text "strip me" strip more text? "strip me also" 108',
't3"strip" no strip "strip again" keep me "3rd strip" don\'t strip
me',);
print "first regex... (a bit greedy)\n";
for my $log (@log_entries){
$_ = $log;
s/".*"//;
print "$log:\n$_\n\n";
}
print "second regex... (and killing spaces leading the \"text\")\n";
for my $log (@log_entries){
$_ = $log;
s/\s*".*"//;
print "$log:\n$_\n\n";
}
print "\nthird regex... (not so greedy)\n";
for my $log (@log_entries){
$_ = $log;
s/".*?"//g;
print "$log:\n$_\n\n";
}
print "\nfourth regex... (and killing spaces leading the \"text\")\n";
for my $log (@log_entries){
$_ = $log;
s/\s*".*?"//g;
print "$log:\n$_\n\n";
}
*waiting for the improvements...*
Regards,
Tim Bowden
On Mon, 2009-08-24 at 12:44 +0200, Gregory Machin wrote:
> SC 11-Aug-2009 07:54:38 626 "Heinrich"
> 107 [email protected]:5060
> 171665a3-9560-4003-a649-9eeb72214130 N/A N/A 10.0.1.249:6090
> - 10.0.1.197:2234 1
> (excellent) G729a G729a 31343 31348 20 20 0 15
> 170 0 0 66.8.102.5:6092
> - 41.203.29.100:13682 5 (very
> bad) G729a G729a 31348 31343 20 20 10131 16
> 39904660 0 0 N/A N/A N/A N/A N/A N/A
> N/A
>
> SC 11-Aug-2009 07:58:45 332 PSTN2/1-?(00) "Prashil"
> 106 d8324eef-c206-4f8e-bf9e-673419f76233 PSTN call,PSTN
> call N/A 10.0.1.249:6000 - 10.0.1.174:2226 1
> (excellent) G729a G729a 16360 16370 20 20 0 15
> 63 0 5 N/A N/A N/A N/A N/A N/A N/A
> N/A N/A N/A N/A N/A N/A N/A N/A N/A
> N/A N/A N/A N/A
>
> MC 11-Aug-2009 08:04:16 0 "Prashil" 106 "Hishal"
> 111 32171bd8-db95-4392-9aa5-8f5b40ccd01d N/A N/A N/A N/A
> N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A
> N/A N/A N/A N/A N/A N/A N/A N/A N/A
> N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A
> N/A N/A
>
> SC 11-Aug-2009 08:00:49 91 PSTN1/1-"Returned Call:"
> <?> "Malcolm"
> 112 2601d0b4-8e53-40b4-9fa8-1d16b0e49c74 PSTN
> call N/A 10.0.1.249:6014
> - 10.0.1.178:2230 1
> (excellent) G729a G729a 4546 4556 20 20 0 1
> 3 0 4 N/A N/A N/A N/A N/A N/A N/A
> N/A N/A N/A N/A N/A N/A N/A N/A N/A
> N/A N/A N/A N/A
>
> SC 11-Aug-2009 07:58:56 179 PSTN0/1-? "Lourens"
> 109 39c8b046-471a-4256-99c4-5cc97b0e084b PSTN
> call N/A 10.0.1.249:6004
> - 10.0.1.177:2222 1
> (excellent) G729a G729a 8925 8929 20 20 0 15
> 20 0 4 N/A N/A N/A N/A N/A N/A N/A
> N/A N/A N/A N/A N/A N/A N/A N/A N/A
> N/A N/A N/A N/A
>
> SC 11-Aug-2009 07:59:12 73 PSTN1/1-?(00) "Malcolm"
> 112 2601d0b4-8e53-40b4-9fa8-1d16b0e49c74 PSTN call,PSTN
> call N/A 10.0.1.249:6006 - 10.0.1.178:2226 1
> (excellent) G729a G729a 3049 3053 20 20 0 10
> 6 0 4 N/A N/A N/A N/A N/A N/A N/A
> N/A N/A N/A N/A N/A N/A N/A N/A N/A
> N/A N/A N/A N/A
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/