in reply to Re^3: awk like question in perl
in thread awk like question in perl
can anyone shed some light? Also to use the Perl grep I have code as follows but it is not working.## Define ENV $ENV{"PATH"} = qq(/usr/epoch/bin:/usr/epoch/EB/bin:/usr/bin:/usr/sbin: +/bin:/sbin); delete $ENV{"IFS"}; ## Declare scalers for client templates and client tape logs my $scratches="/usr/local/log/scratch_tapes.log"; my $logf="/usr/epoch/EB/log/ebcat.log"; ## Gather data for scratch tapes; open file, create array list, then p +rint it. open (FOO, ">$scratches") || die "could not open file:$!"; my $scratch_list = `grep 9840S $logf |grep "ebexpire, ebexpire +"`; print FOO "$scratch_list"; while (<FOO>) { local $, = "\t"; print +(split)[0,1,5], $/; } close (FOO);
2 example lines from the ebcat.log looks like 04/29/04 11:01:17 6687:ebexpire, ebexpire.c@7475 E01012 9840S 820 6E01C1874C2E12CA 04/29/04 11:01:17 6687:ebexpire, ebexpire.c@7475 E01093 9840S 898 9601C7263CDC2B34 thank you!## Define ENV $ENV{"PATH"} = qq(/usr/epoch/bin:/usr/epoch/EB/bin:/usr/bin:/usr/sbin +:/bin:/sbin); delete $ENV{"IFS"}; ## Declare scalers for client templates and client tape logs my $scratches="/usr/local/log/scratch_tapes.log2"; my $logf="/usr/epoch/EB/log/ebcat.log"; open (FOO, ">$scratches") || die "could not open file:$!"; open (D, "$logf") || die "could not open file:$!"; while ( <D> ) { if (( /9840S/ ) && ( /"ebexpire, ebexpire"/ )) { print $_ $scratches } } close (FOO); close (D);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: awk like question in perl
by davido (Cardinal) on Aug 12, 2004 at 16:46 UTC |