From: "Rebhan, Gilbert" Date: 2007-02-07T17:47:26+09:00 Subject: Re: Parse csv similar file Hi, -----Original Message----- From: Phrogz [mailto:gavin@refinery.com] Sent: Tuesday, February 06, 2007 6:00 PM To: ruby-talk ML Subject: Re: Parse csv similar file On Feb 6, 8:36 am, Drew Olson wrote: > I think he wants to append this array with information each time he sees > the same key [...] i still don't know how to go, so here some more notes ... i get a folder /timestamp metafile.txt /INCLIB /PLI metafile looks like that = APLVZDT;INCLIB;E050441;AP013;240107;0730 AP400ER;INCLIB;E023889;AP013;240107;0730 AP540RBP;INCLIB;E052337;AP013;240107;0730 AP700PA;INCLIB;E050441;AP013;240107;0730 ... more lines field 1 is a filename field 2 is a foldername, shows whether path is /INCLIB/file or /PLI/file field 3 is a ticketnr field 4 is a username field 5 is a date field 6 is a timestamp i need to parse the metafile and = 1. create a folderstructure for every ticketnr that occurs, f.e. /E050441 /INCLIB /PLI and put all the files that belong to that ticket (means the line with the filename contains that ticketnr) in the subfolder which is field 2 2. create a file in the root of the /ticketnr folder which contains the rest of a dataset (line), means = field 4 field 5 field 6 which are the same for every file with the same ticketnr the format might look like user=... date=... time=... have to decide it later. I thought with = File.open("mycsvfile", "r").each do |line| if line =~ /(\w+.?);(\w+);(\w+);(\w+);(\w+);(\w+)/ efas<<$3.to_s<<',' unless efas.include?($3.to_s) i get an array with all ticketnr then i create a folderstructure for every index in that array and put the files in it, but i don't get it. Any ideas ? Regards, Gilbert