On 7/1/07, dblack / wobblini.net <dblack / wobblini.net> wrote:
> Hi --
>
> On Sun, 1 Jul 2007, baptiste Auguiwrote:
>
> > Hi,
> >
> > The last bit of a bash program is still resisting me. Here is the code I used
> > before:
> >
> > awk '/scattering efficiency/{print $4}' ../OUTPUTFILES/Output.dat
> >
> >
> > How would you do that in Ruby? I just need to locate this regexp in the file,
> > and get the following value in the same line. I've tried something like,
> >

> $ ruby -ne 'puts $1 if /scattering efficiency\s+(\S+)/'
> scattering efficiency blah
> => blah
> nothing
> this has scattering efficiency just like the other one
> => just
>
The problem is that we have no idea where "scattering efficency" is
relatively to $4 :(
However

ruby -ane 'puts $F[3] if /scattering efficency/' ../ton/beau/fichier

does the same as the awk script above

Side Remark:
domage que l'on ne puisse utiliser mes options prs: -anpe ;)


Robert

-- 
I always knew that one day Smalltalk would replace Java.
I just didn't know it would be called Ruby
-- Kent Beck