From: Austin Ziegler Date: 2004-07-03T01:22:02+09:00 Subject: Re: Help with one-liner 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 -- Austin Ziegler * halostatue@gmail.com * Alternate: austin@halostatue.ca