http://www.perlmonks.org?node_id=366563


in reply to reading from a textfile

Just a different way to do it.

#!/usr/local/bin/perl -w use strict; my $data = do { local($/); <> }; print qq{$1\n} if ( $data =~ /(Testnok =[^>]+>)/s )

Or all right on the command line. Prob a cleaner way to do this though,
but I dont have my Camel book with me. Bet this could be done better with a couple more switches.

perl -e 'print $1 if ( do{local $/; <>} =~ /(Testnok =[^>]+>)/s)' data +.txt

Wonko