Le Ven 31 août 2012 6:42, daniel jimenez a écrit : > Hello guys, > > > @richard, > > > 1 this is not homework, a friend asked me to do some statistics on an > experimental dataset he got for his masters thesis and the file was > already that way. > > 2 i'm well versed in fortran, this problem however is not what i'm used > to. I thought about reading the line bare in character mode, but thought > there should be a more time-efficient (coding time, that is) tool for this > type of problem than some 'tab-finding' code in fortran which would just > obfuscate my code unnecessarily. > > 3 apart from R code, I'm not used to object oriented oriented programming > and I have only done bash for scripting. I read a bit of the usefulness > of perl, awk and sed a while ago but I haven't had the time to get into > that yet. > > 4 I thought reading someone's suggestions (and retyping the proposed > code) on this task would be a nice way of learning a few basic concepts on > some of these scripting languages. That is why I stated the problem the > way I did, for others to understand the problem easily and throw some > lines of code at lunch time or something.. I've done that on physics > forums for fortran code or bash scripts (which generally automates fortran > program runs, archival of datafiles and plotting with gnuplot) > > 5 The data is from a photon counter, I don't know why it is encoded like > that... > > @john > > > I'm having a look at your solution and expect to learn from it. Many > thanks! > > daniel >
About the 3rd point, code snippets were not using Oriented Object paradigm, except if you consider that a command is an object which can be casted in a string...(and using OOP for this script would have been like taking a bazooka to kill a fly imho) The paradigm used in those codes was the same as the one you use in bash: imperative programming. As far as I remember, bash could have done such scripts: _ using grep into extract lines. Maybe a combination of head and tail could do that too. With some magic behind. _ using for to parse each line, because if I am not wrong, this loop in bash just take the first word of a "phrase" where words are split by spaces I could be wrong, because I do not really master bash scripts... Maybe I'll try to implement something to extract words with bash, someday, could be an interesting exercise. -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/31432efbf8f41a0b716b2ef8e7ca8128.squir...@www.sud-ouest.org