Knoperl has asked for the wisdom of the Perl Monks concerning the following question:
<file#2>applebananapearcarrotcarrotbeardeerdeer goatcowduckswanchickenmouseratbirdmouse chocolatedogdogfishmousecatdeerbird newyorkcalifornianewjerseymousecatdeerbird
The output should be:monksbicyclewindbikecars computercomputerprinters hellicopterairplaneshelf chocolatedogdogfishmouse printerprintermousecouch . . goes on for another 600,000 lines
#!/usr/bin/perl -w use strict; my %lines; my %lines2; my $str2; open(UNIQUES,"<$ARGV[0]"); open(ALL, "<$ARGV[1]"); while (<UNIQUES>) { $lines{$str1} = 1; } while (<ALL>) { print $str1 if substr( $str1, 0, 24) eq ($str2); next ($str2); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Compare Partial Lines of 2 Text Files
by GrandFather (Saint) on Jul 31, 2007 at 00:00 UTC | |
by Knoperl (Acolyte) on Jul 31, 2007 at 00:33 UTC | |
by GrandFather (Saint) on Jul 31, 2007 at 01:14 UTC | |
|
Re: Compare Partial Lines of 2 Text Files
by Anonymous Monk on Jul 31, 2007 at 07:46 UTC | |
by Knoperl (Acolyte) on Jul 31, 2007 at 20:21 UTC |