Reading from a bunch of files.

2002-07-15 Thread Vishal Kapoor
Hi, 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 ?? Thanx.. Vishal Kapoor -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Reading from a bunch of files.

2002-07-15 Thread Connie Chan
contained whatever . Code not tested, just for reference =) Rgds, Connie - Original Message - From: Vishal Kapoor [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, July 15, 2002 10:41 PM Subject: Reading from a bunch of files. Hi, I want to read a few files and search

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 (FH) { push @record, $file if ($_ =~ /$pattern/ig) } close (FH)

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 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)' yourfiles*