Thanks Doug, I was hopeful as I hadn't thought of doing that before.

Unfortunately I get the following error.
Runtime error: Can't use an undefined value as an ARRAY reference at 
c:/Perl/site/lib/PDL/IO/Misc.pm line 664.

For the command:
($val1, $val2, $val3, $val4, $name) = rcols ('filename.txt' , 0,1,2,4, { 
INCLUDE=>'/^\s+(\d)\t(\d)\t(\d+)\t(\w+)\t\d\t\w+\s+w+\s+\d+\t(\-\d+\.\d+)\s+\d+\t\d+0x[0-9A-F]+$/',
 PERLCOLS => [ 3 ]})

I thought that it would treat the $name as the last populated item as a PERLCOL 
with it being the 4th item in the regexp. 


CLIFF SOBCHUK
Core RF Engineering
Phone 613-667-1974   ecn: 8109-71974
mobile 403-819-9233
yahoo: sobchuk
www.ericsson.com 

"The author works for Telefonaktiebolaget L M Ericsson ("Ericsson"), who is 
solely responsible for this email and its contents. All inquiries regarding 
this email should be addressed to Ericsson. The web site for Ericsson is 
www.ericsson.com."

This Communication is Confidential. We only send and receive email on the basis 
of the terms set out at www.ericsson.com/email_disclaimer


-----Original Message-----
From: Douglas Burke [mailto:[email protected]] 
Sent: May-19-11 9:21 AM
To: [email protected]
Subject: Re: [Perldl] Using rgrep multiple times on the same file

On 5/18/11 10:46 PM, Clifford Sobchuk wrote:
> Using rgrep to capture the first 4 fields and the 9th field. The data 
> is intermixed with other data in the file so I can't use rcols.

Cliff,

Can you use the INCLUDE or EXCLUDE options of rcols to filter out the unwanted 
lines (e.g. use something like

 
INCLUDE=>'/^\s+(\d)\t(\d)\t(\d+)\t(\w+)\t\d\t\w+\s+w+\s+\d+\t(\-\d+\.\d+)\s+\d+\t\d+.*/'

), or am I just being dense and this is a spectacularly-stupid idea ;-)

I was also going to suggest doing a "pre-filter" stage, whereby you read in the 
file and filter out all the unwanted lines before using rcols or rgrep, but 
then I remembered that my perl-fu has all leaked away and I can't remember if 
you can treat a string as a filehandle (as I think rcols/rgrep require); I'm 
sure there's away but I don't know it off hand.

Doug

_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to