Re: HowTo parse huge Files
- From: "Thomas J." <jue@xxxxxxxxxxxxxxxxx>
- Date: 29 Mar 2007 07:20:49 -0700
cadetg@xxxxxxxxxxxxxx schrieb:
my %lookingFor;
# keys => different name of one subset
# values => array of one subset
my $fh = new FileHandle "< largeLogFile.log";
while (<$fh>) {
foreach my $subset (keys %lookingFor) {
foreach my $item (@{$subset}) {
if (<$fh> =~ m/$item/) {
my $writeFh = new FileHandle ">> myout.log"; print $writeFh <
$fh>;
}
}
}
Your code will "copy" the following lines from "lagreLogFile.log"
after successful patternmatch into "myout.log"
This may be time-consuming... ...and possible not what you expected?
(use $_ instead of <$fh> in your "if" and in your "print")
REs may lead to "endless matching". Please show some samples.
study may/may_not help before patternmatching. (perldoc -f study)
Thomas
.
- References:
- HowTo parse huge Files
- From: cadetg@xxxxxxxxxxxxxx
- HowTo parse huge Files
- Prev by Date: Re: multiple inheritance and instance data?
- Next by Date: Re: multiple inheritance and instance data?
- Previous by thread: Re: HowTo parse huge Files
- Next by thread: Re: HowTo parse huge Files
- Index(es):
Relevant Pages
|
|