Re: Reading from a bunch of files.

2002-07-15 Thread Paul Johnson
On Mon, Jul 15, 2002 at 02:43:14PM -0700, John W. Krahn wrote: > Vishal Kapoor wrote: > > > > I want to read a few files and search for a particular word. I want to then > > print a list of all the files with that word. > > Any ideas ?? > > perl -lne'/\bparticular\b/&&print($ARGV)&&close(ARGV)'

Re: Reading from a bunch of files.

2002-07-15 Thread John W. Krahn
Vishal Kapoor wrote: > > I want to read a few files and search for a particular word. I want to then > print a list of all the files with that word. > Any ideas ?? perl -lne'/\bparticular\b/&&print($ARGV)&&close(ARGV)' yourfiles* John -- use Perl; program fulfillment -- To unsubscribe, e-ma

Re: Reading from a bunch of files.

2002-07-15 Thread Jeff 'japhy' Pinyan
On Jul 15, Vishal Kapoor said: >I want to read a few files and search for a particular word. I want to then >print a list of all the files with that word. my @hits; my $word = "japhy"; { local @ARGV = @files_to_search; while (<>) { if (index($_, $word) != -1) { push

Re: Reading from a bunch of files.

2002-07-15 Thread ccurtis
On Mon, Jul 15, 2002 at 11:23:52PM +0800, Connie Chan wrote: > my @Files = ( . ); # List of file names here. > my @record = ( ); > my $pattern = "whatever"; > > foreach $file(@Files) > {open FH, $file; > while () > { push @record, $file if ($_ =~ /$pattern/ig) } > cl

Re: Reading from a bunch of files.

2002-07-15 Thread Connie Chan
my @Files = ( . ); # List of file names here. my @record = ( ); my $pattern = "whatever"; foreach $file(@Files) {open FH, $file; while () { push @record, $file if ($_ =~ /$pattern/ig) } close (FH) } ## @record will probrably grabbed all the file names while con