From: Colin Bartlett Date: 2010-07-26T06:30:19+09:00 Subject: Re: re-organize original text data then write in files --000e0cd7204256517e048c3cf992 Content-Type: text/plain; charset=ISO-8859-1 On Sat, Jul 24, 2010 at 11:24 AM, Junhui Liao wrote: > ... > Already, I developed a script in C++, but it cost around 3 hours to deal > with this job. > And I am totally new guy to ruby, perl, a little on Python. > So, my question is, > > 1, how many time it will be cost to do this job under ruby? > If the time less than one and a half hours, then it worth to study for > me. I was attracted by the beautiful ruby, already : ) . I'm neither a Ruby expert nor an expert programmer, but I have been using Ruby (for my own purposes) for over 8 years, and as a thought exercise I tried this (not actually running anything), and it took me about 20 to 30 minutes, *provided* the computer memory is big enough to hold all the data. (I couldn't think of an easy way to what I think you want to do without reading in all the data first, modifying it, then writing it out. That, or open 4096 files at the same time: neither way seems elegant.) And if you can do that in C++ then I'm sure you can probably do it in Ruby, Perl, Python, etc, etc. If you can program in C++ then I see no reason why you wouldn't be able to program in Ruby, Perl, Python, etc. (It might look like C++ rewritten in R, P, P, etc, but so what if you're trying things out.) Personally, if I didn't have much time, and I wanted to try something out in another computer language, I'd go with a language that I knew a little about, so in my case that would be Ruby, Pascal, Qbasic (!!!), and - in your case - maybe try something quick in Python. (But I'd also encourage you to look at Ruby sometime and try it.) Maybe it partly depends on what standard methods/functions are available: for example, in Ruby you can read a line from a file into a String, and then use a builtin method on the String to split it into an array of values using a specified delimiter, so in your case a space character? But I'd be very surprised if there weren't similar builtins in Perl and Python. --000e0cd7204256517e048c3cf992--