From: ts Date: 2006-03-14T02:11:14+09:00 Subject: Re: simple one-liners: last line missing >>>>> "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, Guy Decoux