rajyalakshmi has asked for the wisdom of the Perl Monks concerning the following question:
Hi all
I am using grep function and grepping few characters from a file.Now i want to print the entire line in the file which has the characters that matched.
open(FILE,"$filepath") or die "Couldn't open file for writing: $!";
$error1=(grep {/0 Items in Feed & 0 New Fetched items/} <FILE>);
if($error1) { print "match found"; } else { print"nothing"; }
close FILE;Now in the above after getting match,i want to print the entire line in which i found the match and grepped
can anyone help me with this
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: printing the line after grepping
by moritz (Cardinal) on Nov 11, 2009 at 14:05 UTC | |
by 7stud (Deacon) on Nov 11, 2009 at 17:13 UTC | |
by ikegami (Patriarch) on Nov 11, 2009 at 17:50 UTC | |
by 7stud (Deacon) on Nov 11, 2009 at 18:23 UTC | |
by ikegami (Patriarch) on Nov 11, 2009 at 18:29 UTC | |
|
Re: printing the line after grepping
by happy.barney (Friar) on Nov 11, 2009 at 13:56 UTC | |
by rajyalakshmi (Acolyte) on Nov 11, 2009 at 14:01 UTC | |
by ikegami (Patriarch) on Nov 11, 2009 at 16:56 UTC | |
by rajyalakshmi (Acolyte) on Nov 12, 2009 at 05:53 UTC | |
|
Re: printing the line after grepping
by johngg (Canon) on Nov 11, 2009 at 14:06 UTC | |
|
Re: printing the line after grepping
by ack (Deacon) on Nov 11, 2009 at 17:44 UTC | |
by ikegami (Patriarch) on Nov 11, 2009 at 18:04 UTC |