fatfinger has asked for the wisdom of the Perl Monks concerning the following question:
########################################################### open(FILE, "<C:\\FolderA\\test.txt")or die("Can't find file name at $F +ILE"); #Get user input print"Please type the term you're looking for\n"; $input=<STDIN>; chomp $input; #Read in lines of text file while ($lines=<FILE>) { chomp ($lines); $cnt++; #Find any lines within the text file that contain user input ($input) + and print them. if($lines=~/$input/i) { print"$lines\n"; } } close(FILE); ###########################################################
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Extracting Lines of a text file
by graff (Chancellor) on Nov 04, 2008 at 01:14 UTC | |
|
Re: Extracting Lines of a text file
by apl (Monsignor) on Nov 04, 2008 at 01:09 UTC | |
|
Re: Extracting Lines of a text file
by ikegami (Patriarch) on Nov 04, 2008 at 10:42 UTC | |
by baxy77bax (Deacon) on Nov 04, 2008 at 12:01 UTC | |
|
Re: Extracting Lines of a text file
by baxy77bax (Deacon) on Nov 04, 2008 at 10:16 UTC | |
by ikegami (Patriarch) on Nov 04, 2008 at 10:35 UTC | |
|
Re: Extracting Lines of a text file
by sanku (Beadle) on Nov 04, 2008 at 11:41 UTC |