From: 7stud -- Date: 2007-10-17T14:58:01+09:00 Subject: Re: How to remove "~" in those files Vidya Vidya wrote: > thanks for reply, actually i want to remove only end of the last record > "~", to each file, here this is my coding, please let me, in this i > should remove the last "~" only. > > Dir["#{dirname}/**/**"].each do | thisfile | > @m=@m+1 > thisfile.gsub! ( /\// , '\\' ) > results.push ( thisfile ) > f = File.open(thisfile,"r") > @read_file=f.read() > @split_record=@read_file.split("~") > The last line removes all "~" from the data, so there isn't a '~ ' on the last line or any other line. -- Posted via http://www.ruby-forum.com/.