Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Print line from file only once even if occurrence of pattern is more than once in the lineby jayu_rao (Sexton) |
on Mar 29, 2015 at 17:16 UTC ( [id://1121711]=perlquestion: print w/replies, xml ) | Need Help?? |
jayu_rao has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks,
I have written a code that matches the occurrence of the words like Error / Fatal etc from a log file and printing it to a temporary file. However, the problem is that the words can occur more than once in a line like " ERROR - Critical error" or something like FATAL - Fatal error and this causes the lines to get printed more than once because of the patterns getting repeated more than once.Can someone help me in suggesting a way to print the lines only once per occurrence in a line with an example? Regards,Jay
Back to
Seekers of Perl Wisdom
|
|