From: Srijayanth Sridhar Date: 2009-08-06T17:07:51+09:00 Subject: Re: Trimming some string using ruby --000e0cd5160c353d470470748465 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit file = File.open("foo") filenames = file.map do |line| line.chomp.split(/ +/,9)[-1] end p filenames Jayanth On Thu, Aug 6, 2009 at 12:01 PM, Shekar Ls wrote: > Hi guys, > I have the following information in a text file, which looks > like this: > > -rw-rw-r-- 1 user user 12203 Aug 6 01:02 app1.sql > -rw-rw-r-- 1 user user 12343 Aug 6 01:02 app2.sql > -rw-rw-r-- 1 user user 12238 Aug 6 01:02 app3.sql > > I need to Trim the unwanted strings and my output should look like this: > > app1.sql > app2.sql > app3.sql > > I am not good at string functions...let me know if anyone can help me > out!! > > cheers > -- > Posted via http://www.ruby-forum.com/. > > --000e0cd5160c353d470470748465--