From: Philip Mateescu Date: 2004-07-03T01:33:36+09:00 Subject: Re: Help with one-liner Thanks. However, I'm temporary stuck with 1.6.8; I get the same result using your variation. I think at this point I'm more curious as to why does it do it rather than how to fix it :) Austin Ziegler wrote: > On Sat, 3 Jul 2004 01:13:17 +0900, Philip Mateescu > wrote: > >>My one liner sample: >> >>$ ping localhost | ruby -e '$<.readlines.each { |line| line.chomp!(); >>puts(line + "---\n"); }' >> >>I would expect it to put --- at the end of each line. Instead it >>replaces the first 3 chars of each line with "---" > > > Using 1.8.1, I have no problems if I change it to: > > ping localhost | ruby -e "$<.readlines.each { |line| puts > %Q(#{line.chomp}---) }" > > #puts automatically places a \n at the end of the line, and it's > better to use interpolation. The reason that I switched from -e '...' > to -e "..." is because I tested it on Windows. > > -austin Best regards. philip ---- Lightning flashes, Sparks shower, In one blink of your eyes, You have missed seeing. ---