CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Extract text from multiple lines

 



Amrit
Novice

Jan 4, 2012, 10:18 AM

Post #1 of 2 (794 views)
Extract text from multiple lines Can't Post

Hi,

I have a huge file ...I want to extract data btwn two specific word "List=" and "exe".

The problem is the file is written from server,n is print as follows:

2 Jan 090 120-0 ll Lis
t=
This
is
test
i need. exe

2 Jan 090 120-0 ll List=
This
is
test
i need. exe

2 Jan 090 120-0 ll Li
st=
This
is
test
i need. exe

The characters of "List=" is being printed as new line.

I have tried and lot many other regex bt this works somewhat better but doesnt do the needful.

$string =~ /List\=([\s\S]+?)exe/;
$between = $1;

Any help appreciated

(This post was edited by Amrit on Jan 4, 2012, 10:24 AM)


shawnhcorey
Enthusiast


Jan 6, 2012, 8:46 AM

Post #2 of 2 (777 views)
Re: [Amrit] Extract text from multiple lines [In reply to] Can't Post

Have you tried:

Code
print while /List=/ .. /exe/;


__END__

I love Perl; it's the only language where you can bless your thingy.

Perl documentation is available at perldoc.perl.org. The list of standard modules and pragmatics is available in perlmodlib.

Get Markup Help. Please note the markup tag of "code".

(This post was edited by shawnhcorey on Jan 6, 2012, 8:47 AM)

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives