Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re: Copy multiple lines to a loop

by hippo (Parson)
on May 20, 2014 at 17:00 UTC ( #1086824=note: print w/ replies, xml ) Need Help??

in reply to Copy multiple lines to a loop

Standard input from your terminal is line-buffered so your loop will process each line as it arrives.

To see the output you have shown you could either disable the line-buffering of STDIN (I've never done that and with pretty good reasons) or disable line-buffering of STDOUT (less problematic) or else save your output in the loop to a variable rather than printing directly and then print the entire variable on loop exit.

In any of these cases you will need to send the EOT character to notify the script of the end of input. This is typically ^D

Comment on Re: Copy multiple lines to a loop
Download Code
Replies are listed 'Best First'.
Re^2: Copy multiple lines to a loop
by eyekona (Acolyte) on May 21, 2014 at 08:02 UTC
    Use a variable... Yes sometimes I'm an idiot. Stuff like this happens when admins try to be programmers...

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1086824]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (2)
As of 2015-11-28 11:06 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (741 votes), past polls