Re: [MacPerl-AnyPerl] Differences between two files
[email protected] (John Delacour) Wed, 1 May 2002 11:54:11 +0100
| Newsgroups | perl.macperl.anyperl |
|---|---|
| Message-ID | <v03130301b8f573efbfec@[195.147.225.201]> |
At 9:54 am +0200 30/4/02, Barbara Manfredini wrote:
| I need to find every line in a file where compare a name of a different big
| list(in another file).I need every line in a new file.
#perl -w
open F, "france" or die $!; chomp (@nom = <F>); #list names
open F, "/etc/passwd" or die $!; @pas = <F>; #list passwd lines
open F, ">temp.txt"; #create file for results
for $n (@nom) { #loop through the names
for (@pas) {/^$n:/ and print F }} #loop writing matching lines to temp.txt
#View contents of temp.txt:-
open F, "temp.txt"; print "$/$/"; print <F>;
JD