From: Rafael George Date: 2007-02-28T04:07:27+09:00 Subject: Re: Comparing two arrays On 2/27/07, Phrogz wrote: > On Feb 27, 11:42 am, "Rafael George" wrote: > > Ok, thanks now im trying to take out this from a anyline on the file > > > > ----- > > or > > [a-zA-Z] or # > > > > this is the code that im using, but the lines stays with something > > because my script parse that line. Another suggestion ? > > delete("#[a-zA-Z]-").strip > > I'm sorry, but I do not understand at all what you are asking. I > assume English isn't your first language (and that's OK). Could you > try writing it a different way, so maybe I can help you? > > P.S. It's considered bad form on the Internet and particularly this > forum to "top post", putting your reply above the original text. In > the future, please try to put your reply after the quoted text, so > that the original flow of responses continues from top to bottom. > > > Sorry for that about the post i did not know. Maybe if i show you some code you can check what am i trying to do. Anyway i will try to make a simple explanation: I parsing a CSV file using the module from the Ruby standard lib, by far i have the parsing ok and the comparation too. So the problem is that i don't need to fieldnames to get in the comparation process, so i was trying to take out the letters and - and # from the output. The problem now is that i just notice that some columns in the data have letters too so if i take out that it won't make any sense. If you have a suggestion can be a of a lot of help, thanks data = [] i = 0 IO.foreach(filename) do |line| cols = [] cols=CSV::parse_line line.delete("#[a-zA-Z]-").strip if (cols[args[0]] != nil) && (cols[args[1]] != nil) if cols[args[0]].slice(0,1).to_i > 0 && cols[args[0]].length < 7- cols[args[0]].chop.strip cols[args[1]].chop.strip data[i] = "0"+cols[args[0]]+"-"+cols[args[1]] else data[i] = cols[args[0]].sub(/[^\w]/,'')+"-"+cols[args[1]] end i += 1 end 79 end 80 return data -- Grimoire Guru SourceMage GNU/Linux