Reply to Jason R. Finley <[EMAIL PROTECTED]> 07-01-25 07:53:

I've looked high and low but can't figure out how to easily do this: I
have two text files.  In the first is a list of words (one word per
line), and for EACH of those words, I have to search and see if it
exists in the second text file.  How can I automate this?  (preferably
without reinventing the wheel) thanks very much,

Something like this might work

#!/usr/bin/perl -w

# scriptname firstFile secondFile
use strict;

open( SECOND, "<$ARGV[1]" ) ||
    die "Couldn't open $ARGV[1]";

my %sec;

while( <SECOND> ){
    chomp;
    $sec{$_} = 'x';
}

close( SECOND );

open( FIRST, "<$ARGV[0]" ) ||
    die "Couldn't open $ARGV[0]";

while( <FIRST> ){
    chomp;
    print "Existed in other file $_\n" if $sec{$_};
}

close( FIRST );

--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <[EMAIL PROTECTED]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to:  <[EMAIL PROTECTED]>

Reply via email to