in reply to Re: Super fast file creation needed
in thread Super fast file creation needed
... thanks Joost and Monks!#!/usr/local/bin/perl -w use strict; my %seen; my @logfiles = glob ( "*access_log" ); foreach my $logfile (@logfiles) { open ( MYLOG, ">>progress_safe" ); print MYLOG "Doing $logfile\n"; close ( MYLOG ); process_file( $logfile ); } sub process_file { my $fn = shift; open ( FH, "<$fn" ); while (<FH>) { chomp; s/\W/_/g; my $new_empty_file = substr( $_, 0, 200 ); my $target = "$new_empty_file"; if ( $seen{$target} && ($fn ne $seen{$target}) ) { $seen{$target} = "$seen{$target} and $fn both +have :$target\n"; open ( DUP, ">>dups_found_safe" ); print DUP "$seen{$target}"; close DUP; } else { $seen{$target} = "$fn"; } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Super fast file creation needed
by chromatic (Archbishop) on Oct 19, 2007 at 05:37 UTC |