Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

matching multiple words within multiple lines in a file

by kaushik9918 (Sexton)
on Dec 02, 2014 at 08:51 UTC ( [id://1108929]=perlquestion: print w/replies, xml ) Need Help??

kaushik9918 has asked for the wisdom of the Perl Monks concerning the following question:

Hi I have a text input file :
dhs dskfsdk fsfksdfsdk { ajaj aksakj kffkfm sksk \ sndsjd sdasd sdsdsa sdasdsa sdasd sdas asd\ dsfd sdfdsf fsdfds sdfe erewr grtgw erewr} -xyz sds begin1 ... ... .. end1 begin2 .. .. end2 fd grtgrt hytht
I want to find if the words between begin1-end1 and begin2-end2 exist between { and }. Also note that sometimes, the text file might not have the character "\" and it might be only one single line , for ex..
dhs dskfsdk fsfksdfsdk { ajaj aksakj kffkfm sksk } -xyz sds begin1 ... ... .. end1 begin2 .. .. end2 fd grtgrt hytht
Please let me know a PERL subroutine to implement this. Thanks.

Replies are listed 'Best First'.
Re: matching multiple words within multiple lines in a file
by Anonymous Monk on Dec 02, 2014 at 08:59 UTC
    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: matching multiple words within multiple lines in a file
by kaushik9918 (Sexton) on Dec 02, 2014 at 10:15 UTC
    Thanks @Corion!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2024-03-29 13:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found