I found a couple of problems in my rcols format and the regexp and have
corrected that so that rcols responds without error. I missed that the INCLUDE
is just the filter and had the listed the columns as per the groupings, and I
had forgotten the PERLCOL in the column identifiers.
($val1, $val2, $val3, $name, $val4) = rcols ('filename.txt' ,\
0,1,2,3,8, {
INCLUDE=>'/^\s+\d\t\d\t\d+\t\w+\t\d\t\w+\s+\w+\s+\d+\t\-\d+\.\d+\s+\d+\t\d+\t0x[0-f]+$/',\
PERLCOLS => [ 3 ]})
It does capture all of the numeric data. I still can't get the name though. Do
I have to specify that the PERLCOL is a string somehow?
Thanks,
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: Clifford Sobchuk [mailto:[email protected]]
Sent: May-19-11 11:05 AM
To: Douglas Burke; [email protected]
Subject: Re: [Perldl] Using rgrep multiple times on the same file
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
_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl