Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Print line from file only once even if occurrence of pattern is more than once in the line

by sandy105 (Scribe)
on Mar 30, 2015 at 11:16 UTC ( [id://1121798]=note: print w/replies, xml ) Need Help??


in reply to Print line from file only once even if occurrence of pattern is more than once in the line

i wrote something similar a while back .

@line = <filehandle> #filehandle used for opening the file foreach my $line (@lines) { #note i am matching a line doing something like printin +g and then using next .. if($line =~/^ProcessName:/){ $mess = substr $keyword , 13; $unirec{$id} .="$date,$id,$mess\n"; next; } if($line =~/^Process Message :/ ){ $mess = substr $keyword , 18; $unirec{$id} .="$date,$id,$mess\n"; next; } }
  • Comment on Re: Print line from file only once even if occurrence of pattern is more than once in the line
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1121798]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (6)
As of 2024-04-18 21:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found