Puts - not putting 'all' content on display console

D

Dave Balmer

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?
 
D

David Rio

I am using Ruby 1.86 to process a 7,000+ record file and using Regular
Expressions to select and process content. =A0To ensure that the Regexp
are working correctly, I have been using =93puts=94 to direct selected
records to the console for examination. =A0On examining the console outpu= t
from the =93puts=94 command I don=92t seem to get all of the records bein= g
selected through the Regexp. =A0My question is this: in using a simple
=91puts=92 command, is there some argument that must be added to get ever= y
selected record to be displayed on the console output? =A0And 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?

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
 
E

Eric Christopherson

I am using Ruby 1.86 to process a 7,000+ record file and using Regular
Expressions to select and process content. =A0To ensure that the Regexp
are working correctly, I have been using =93puts=94 to direct selected
records to the console for examination. =A0On examining the console outpu= t
from the =93puts=94 command I don=92t seem to get all of the records bein= g
selected through the Regexp. =A0My question is this: in using a simple
=91puts=92 command, is there some argument that must be added to get ever= y
selected record to be displayed on the console output? =A0And 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?

puts is buffered. Try calling $stdout.flush.
 
D

Dave Balmer

David said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top