I am using Ruby 1.86 to process a 7,000+ record file and using Regular
Expressions to select and process content. To ensure that the Regexp
are working correctly, I have been using “puts†to direct selected
records to the console for examination. On examining the console output
from the “puts†command I don’t seem to get all of the records being
selected through the Regexp. My question is this: in using a simple
‘puts’ command, is there some argument that must be added to get every
selected record to be displayed on the console output? And since I can
associate each record in the 7,000+ file with a record count number, is
there any reason to believe that the output to the console would not
appear in the same sequence as the record numbers being encountered?
On Fri, Apr 2, 2010 at 7:43 AM, Dave B. [email protected] wrote:
appear in the same sequence as the record numbers being encountered?
Umm… there is not.
Can you post some code here? Do you have the same problem when working
with a smaller version of the record file?
-drd
On Fri, Apr 2, 2010 at 8:43 AM, Dave B. [email protected] wrote:
appear in the same sequence as the record numbers being encountered?
puts is buffered. Try calling $stdout.flush.
David Rio wrote:
On Fri, Apr 2, 2010 at 7:43 AM, Dave B. [email protected] wrote:
appear in the same sequence as the record numbers being encountered?
Umm… there is not.
Can you post some code here? Do you have the same problem when working
with a smaller version of the record file?-drd
I have redirected the output to a file instead of just using the
console. I am getting all of the records so it would seem that the
program is OK. But experimenting further with the previous console
output using puts, whenI remove the Regexp filtering component, I can
see all 7,000 records flying by. As the other responder said, it must
be the way that things get buffered. Why when I add the Regexp process
the console output seems to get constrained is still a mystery. Thank
you for your response.
db