From: Tobi Reif Date: 2006-03-14T02:39:19+09:00 Subject: Re: simple one-liners: last line missing On Tue 2006-03-14 Tobi Reif wrote: > On Tue 2006-03-14 ts wrote: > > >>>>> "T" == Tobi Reif writes: > > > > T> $ ruby -pe 'sub(/(\S+)\s+(\S+)/,"#{$2} #{$1}")' data.txt > > > > The replacement string is build when #sub is called > > > > for the first call $1 = $2 = nil ==> the replacement string is ' ' > > > > for the second call, $1 = 'first', $2 = 'foo' ==> the replacement string > > is 'foo first' > > > > etc, > > Thanks. I guess my (current) opinion is that it should work. > > Tobi Now I understand that it can't work. Thanks again, Tobi