From: Diogo Lisboa Date: 2008-11-19T05:47:09+09:00 Subject: Re: selected field assignment On Tue, Nov 18, 2008 at 11:51 AM, Bil Kleb wrote: > Hi, > > I'm grabbing the owner and file names from `find . -perm -g+r -ls` > which has ls -dgils output like, > > 6744065 8 -rw-r--r-- 1 kleb users 289 Nov 30 > 2007 Ruby/README > > with something like, > > find_result.each_line do |line| > fields = line.split > user_name, file_name = fields[4], fields.last > > I've also played with, > > _,_,_,_,user,_,_,_,_,_,file = a.split > > But both leave me thinking there is a better way without resorting > to a regex? owner, file = string.split.values_at(4, -1) It relies on the output being the same format. For other cases a regex would be better. Diogo