Re: Please help parsing file [sed, awk, fortran, bash]

2012-09-01 Thread Alois Mahdal
On Thu, 30 Aug 2012 21:44:04 -0400 John L. Cunningham djoh...@gmail.com wrote: Hi Daniel, Here's my awk solution: [snip] Very nice, this should be added as an example to an awk-learning document :) -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of

Re: Please help parsing file [sed, awk, fortran, bash]

2012-08-31 Thread Morel Bérenger
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

Re: Please help parsing file [sed, awk, fortran, bash]

2012-08-31 Thread Jon Dowland
On Fri, Aug 31, 2012 at 02:18:15AM +, Mark Blakeney wrote: On Fri, 31 Aug 2012 01:31:29 +, Russell L. Harris wrote: This exercise provides the impetus to learn to use a very useful tool, namely Perl. I would suggest python is a much better choice to a young person just starting

Re: Please help parsing file [sed, awk, fortran, bash]

2012-08-31 Thread Jon Dowland
read ignore read ignore index=-1 while read line; do set -- $line index=$((index + 1)) if [ $index != $1 ]; then while [ $(($1 - $index)) -gt 0 ]; do echo $index 0 index=$((index + 1)) done fi index=$1 [ $index -le 1024 ] || break second=1 shift [ $# -le 0 ]

Re: Please help parsing file [sed, awk, fortran, bash]

2012-08-31 Thread Gaël DONVAL
Le vendredi 31 août 2012 à 09:46 +0100, Jon Dowland a écrit : On Fri, Aug 31, 2012 at 02:18:15AM +, Mark Blakeney wrote: On Fri, 31 Aug 2012 01:31:29 +, Russell L. Harris wrote: This exercise provides the impetus to learn to use a very useful tool, namely Perl. I would

Re: Please help parsing file [sed, awk, fortran, bash]

2012-08-31 Thread Miles Fidelman
Gaël DONVAL wrote: Le vendredi 31 août 2012 à 09:46 +0100, Jon Dowland a écrit : On Fri, Aug 31, 2012 at 02:18:15AM +, Mark Blakeney wrote: On Fri, 31 Aug 2012 01:31:29 +, Russell L. Harris wrote: This exercise provides the impetus to learn to use a very useful tool, namely Perl. I

Re: Please help parsing file [sed, awk, fortran, bash]

2012-08-31 Thread Gaël DONVAL
Le vendredi 31 août 2012 à 09:48 -0400, Miles Fidelman a écrit : For going through a file, line-by-line, and massaging the format, my first instinct would be sed. That's what it's intended for. Actually, I did not read the whole thread (shame on me) prior to answering. I think what is really

Re: Please help parsing file [sed, awk, fortran, bash]

2012-08-31 Thread daniel jimenez
I didnt mean to say this was oo programming, only that my background is in strictly scientific computing using structured programming in c and fortran. this rarely requires doing any formating work on lines such as this... as before, the file is from an experimenter who chose the format

Re: Please help parsing file [sed, awk, fortran, bash]

2012-08-31 Thread Gaël DONVAL
Le vendredi 31 août 2012 à 08:21 -0700, daniel jimenez a écrit : as before, the file is from an experimenter who chose the format arbitrarily (maybe the photon counter outputs that, no clue [dont really care]) and Im doing this as a favor. Maybe this experimenter should ask for a program

Re: Please help parsing file [sed, awk, fortran, bash]

2012-08-31 Thread Gaël DONVAL
As usual, I obviously screwed up the indexes... 10 DAT(IDX)=VAL 10 DAT(IDX+1)=VAL WRITE(2,*), i, DAT(i) WRITE(2,*), i-1, DAT(i) Le vendredi 31 août 2012 à 20:00 +0200, Gaël DONVAL a écrit : I have to learn fortran. I just thought this was a

Please help parsing file [sed, awk, fortran, bash]

2012-08-30 Thread daniel jimenez
Hello all, I need some help fixing the format of some pretty strangely compressed data files. An example would be like this: 2883 452 0 7 1 6 2 4 6 10 7 Parsing rules: The first two lines should be ignored. The first column is the 'index', the second column being the 'counter'. If there is no

Re: Please help parsing file [sed, awk, fortran, bash]

2012-08-30 Thread Richard Owlett
daniel jimenez apparently described a *HOMEWORK* problem: Hello all, I need some help fixing the format of some pretty strangely compressed data files. An example would be like this: 2883 452 07 16 2 4 6 107 Parsing rules: The first two lines should be ignored. The first column is the

Re: Please help parsing file [sed, awk, fortran, bash]

2012-08-30 Thread Russell L. Harris
* Richard Owlett rowl...@cloud85.net [120831 00:39]: daniel jimenez apparently described a *HOMEWORK* problem: ... I need some help fixing the format of some pretty strangely compressed data files. An example would be like this: This exercise provides the impetus to learn to use a very useful

Re: Please help parsing file [sed, awk, fortran, bash]

2012-08-30 Thread John L. Cunningham
On Thu, Aug 30, 2012 at 04:37:19PM -0700, daniel jimenez wrote: Hello all, I need some help fixing the format of some pretty strangely compressed data files. An example would be like this: 2883 452 0 7 1 6 2 4 6 10 7 Parsing rules: The first

Re: Please help parsing file [sed, awk, fortran, bash]

2012-08-30 Thread Mark Blakeney
On Fri, 31 Aug 2012 01:31:29 +, Russell L. Harris wrote: This exercise provides the impetus to learn to use a very useful tool, namely Perl. I would suggest python is a much better choice to a young person just starting out. -- To UNSUBSCRIBE, email to

Re: Please help parsing file [sed, awk, fortran, bash]

2012-08-30 Thread lina
On Friday 31,August,2012 08:35 AM, Richard Owlett wrote: daniel jimenez apparently described a *HOMEWORK* problem: Hello all, I need some help fixing the format of some pretty strangely compressed data files. An example would be like this: 2883 452 07 16 2 4 6 107 Parsing rules:

Re: Please help parsing file [sed, awk, fortran, bash]

2012-08-30 Thread Richard Owlett
lina wrote: On Friday 31,August,2012 08:35 AM, Richard Owlett wrote: daniel jimenez apparently described a *HOMEWORK* problem: Hello all, I need some help fixing the format of some pretty strangely compressed data files. An example would be like this: 2883 452 07 16 2 4 6 107 Parsing rules:

Re: Please help parsing file [sed, awk, fortran, bash]

2012-08-30 Thread lina
On Friday 31,August,2012 11:22 AM, Richard Owlett wrote: lina wrote: On Friday 31,August,2012 08:35 AM, Richard Owlett wrote: daniel jimenez apparently described a *HOMEWORK* problem: Hello all, I need some help fixing the format of some pretty strangely compressed data files. An example

Re: Please help parsing file [sed, awk, fortran, bash]

2012-08-30 Thread daniel jimenez
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