Goncalves, Jorge (Ext) wrote: > Hi List , I have this to print: > 1 > 2 > 3 > > with this script but it didn't work: > #!/usr/bin/perl > use strict; > use warnings; > > { > local $/; > my $file = <DATA>; > while ($file =~ /^\s+(\d+).(.+)$/) { > print $1\n if $2 =~ /extractStat/; > } > } I changed your script like this: { local $/; my $MyId; my $MySrch; my $file = <DATA>; while ($file =~ /^\s+(\d+).(.+:\d+\n.+)$/mg ) { $MyId = $1; $MySrch = $2; # printf "MyId= %2d\n<%s>\n", $MyId, $MySrch; print $MyId . "\n" if ( $MySrch =~ /extractStat/mg ); } }
which then printed out 1 2 3 Wags ;) > > __DATA__ > ?tat ID Jour Heure Ligne de > commande > ------------------------------------------------------------------------------- > > 1 Chaque L Ma Me J V S D 00:20 > D:\lotus\notes\extractStat.exe StatA090 j > 10 Demain 10:00 test\test2 > 2 Chaque L Ma Me J V S D 00:21 > D:\lotus\notes\extractStat.exe StatA090 m > 25 Tomorow only\testing > 3 Chaque L Ma Me J V S D 00:22 > D:\lotus\notes\extractStat.exe StatA090 h Any questions and/or problems, please let me know. Thanks. Wags ;) Int: 9-8-002-2224 Ext: 408-323-4225x2224 ******************************************************* This message contains information that is confidential and proprietary to FedEx Freight or its affiliates. It is intended only for the recipient named and for the express purpose(s) described therein. Any other use is prohibited. ******************************************************* -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>