From: Bertram Scharpf Date: 2009-08-06T20:03:33+09:00 Subject: Re: Trimming some string using ruby Hi, Am Donnerstag, 06. Aug 2009, 15:31:51 +0900 schrieb Shekar Ls: > 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 As the file size will vary in width and the file names could contain spaces this will be a little bit safer: l = "-rw-rw-r-- 1 user user 12238 Aug 6 01:02 app3.sql" filename = (l.split nil, 6).last[ 13..-1] Bertram -- Bertram Scharpf Stuttgart, Deutschland/Germany http://www.bertram-scharpf.de