Re: looking for a string in multiple files

2003-01-23 Thread Rob Dixon
John W. Krahn wrote: > > I think you mean: > > $files = join ' and ', (join ', ', @files), $_ for pop @files; > > But that will prepend ' and ' if there is only one file name in > @files. Thanks. > It also doesn't seem right to use a loop just to force 'pop > @files' to evaluate first. It's

Re: looking for a string in multiple files

2003-01-23 Thread John W. Krahn
Rob Dixon wrote: > > Hello John. Well hello Rob, > John W. Krahn wrote: > >> How about this: :-) > > > > Oops! slight change. :-) > > > > use strict; > > use warnings; > > > > my %zone; > > > > # get zone names from named.conf type files > > @ARGV = qw( one.txt two.txt three.txt ); > > /^zon

Re: looking for a string in multiple files

2003-01-23 Thread Rob Dixon
Hello John. John W. Krahn wrote: >> How about this: :-) > > Oops! slight change. :-) > > > use strict; > use warnings; > > my %zone; > > # get zone names from named.conf type files > @ARGV = qw( one.txt two.txt three.txt ); > /^zone\b[^"]*"([^"]+)/ and push @{$zone{$1}}, "$ARGV, " while <>; I

Re: looking for a string in multiple files

2003-01-22 Thread John W. Krahn
"John W. Krahn" wrote: > > Rob Dixon wrote: > > > > Marco wrote: > > > On Wed, Jan 22, 2003 at 01:07:19PM -, Rob Dixon > > > <[EMAIL PROTECTED]> wrote: > > > > > >> push @files, join ' and ', delete @files[-2,-1]; > > > > > > Your program successfully matches the entries, prints in

Re: looking for a string in multiple files

2003-01-22 Thread John W. Krahn
Rob Dixon wrote: > > Marco wrote: > > On Wed, Jan 22, 2003 at 01:07:19PM -, Rob Dixon > > <[EMAIL PROTECTED]> wrote: > > > >> push @files, join ' and ', delete @files[-2,-1]; > > > > Your program successfully matches the entries, prints in which files > > the string is found: > > >

Re: looking for a string in multiple files

2003-01-22 Thread Rob Dixon
Marco wrote: > On Wed, Jan 22, 2003 at 01:07:19PM -, Rob Dixon > <[EMAIL PROTECTED]> wrote: > >> push @files, join ' and ', delete @files[-2,-1]; > > Your program successfully matches the entries, prints in which files > the string is found: > > Zone foo.com was found in files and

Re: looking for a string in multiple files

2003-01-22 Thread Marco
On Wed, Jan 22, 2003 at 01:07:19PM -, Rob Dixon <[EMAIL PROTECTED]> wrote: > push @files, join ' and ', delete @files[-2,-1]; Your program successfully matches the entries, prints in which files the string is found: Zone foo.com was found in files and boot.fixed But it also pr

Re: looking for a string in multiple files

2003-01-22 Thread Rob Dixon
"Marco" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > The input file only contains lines like: > > foo.com > > But the target file(s) look like this: (example specified is just an example) > > zone "foo.com" { > type master; > file "pri/foo.com"; > }; use

Re: looking for a string in multiple files

2003-01-21 Thread Marco
On Tue, Jan 21, 2003 at 07:48:27PM -0500, Pete Emerson <[EMAIL PROTECTED]> wrote: > You were going for the contents of $file1, correct? Correct. > > Here's my stab. Read in the target files first, then match. > When it walks through the source file, it will print out the name of all > target fi

Re: looking for a string in multiple files

2003-01-21 Thread Pete Emerson
> if ($result eq $file1) This is checking to see if each line matches the filename itself, not the contents of file1. You were going for the contents of $file1, correct? Here's my stab. Read in the target files first, then match. When it walks through the source file, it will print out the name

looking for a string in multiple files

2003-01-21 Thread Marco
What I'm trying to achieve is the following: I have an ASCII text file (zonelist.input) for input which contains a domainname (that is i.e. foo.com) on each line ( a total of about 230 lines are in this file). Furthermore, I have 3 other text files. I'm looking for a method to read each line from