From: sathyz Date: 2008-07-29T15:54:38+09:00 Subject: Re: Gsup with variable when replacing On Jul 28, 5:42 pm, Romain LOMBARDO wrote: > Hi people, > > I'm trying to transform this kind of line : > 123232321 > FOOFOOFOO > .. > 2431232 > BARBARBAR > > to > 123232321  (actually XML) > 2431232 > So I have coded this script > File.open("D:/digisoft/1b.txt","r") do |f2| >   while line = f2.gets >        f3 = line.gsub!(/\d+$/,'\1') >        puts f3 >   end > end > while line = f2.gets print '',line.to_i,'',"\n" if line=~/\d/ end - I am not sure if this is perfect solution, but this works and prints what you expected. Thanks, sathyz