>To keep this simple.
>On the text string I would like to:
>Simple plan:
>1. replace all spaces with commas
>2. strip all information before the date
>
>=== Text string ====
> 172.16.54.132 ssjobhnd Sun Jun 16 10:40:10 2002 SNBJH_3710J Task 1: KB
>transferred 8124972.2 Task time 830 s. Throughput 9789.1 KB/s
>172.16.54.132 ssevthnd Mon Jun 17 19:06:21 2002 SNBEHT4204E 408: *** Error
>mounting SBA232 on device Drive2_001 [status: 1104 (error opening device
>file)] ***
>172.16.54.132 ssjobhnd Mon Jun 17 19:06:21 2002 SNBJH_3036E *** Drive fail
>reported: drive Drive2_001 on node Mstrbkp in job 1024365603 ***
>=== End Text String ===
>
>==== Sample code (which doesn't seem to work)====
># ERROR - global symbol $str requires explicit package
>
>use strict;
>while(<>) {
> $str =~ s/\s/,/g;
> ($keep) = $str =~ /(\w{3} \w{3} .*)/;
>
> print;
>}
>
>===== end script====
your first regex looks good to me, swapping all space characters for a comma
and setting it to $str.
your second regex, however, is using a match rather than a swap, something
you might try is:
while(<>) {
$str =~ s/\s/,/g;
my $str=~s/(\w{3} \w{3} \d{1,2} \d{1,2}.*)/$1/;
# this will make a better match, three letter day, three letter month,
# one or two digit day number and one or two digit hour.
print $str;
# note, printing $_ when you had assigned to $str and were working on
# that may have been the problem, you were printing the wrong part.
}
_________________________________________________________________
Join the world�s largest e-mail service with MSN Hotmail.
http://www.hotmail.com
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs