Excellent, thanks!

Now if only I understood all this better. :)

Geoff

On Apr 26, 9:37 am, James Edward Gray II <j... / grayproductions.net>
wrote:
> On Apr 26, 2007, at 11:00 AM, Geoff wrote:
>
> > It helps a lot!
>
> Good.
>
> > Still getting an error though.
>
> I bet we can fix that.
>
> > Here is the code I used and the error I got:
>
> > require 'rubygems'
> > require 'faster_csv'
>
> > parsed = FCSV.parse('C:/ruby/work/FRIEDEXT01.LFP', 'r')
>
> Let's try changing the above line to:
>
> parsed = FCSV.read('C:/ruby/work/FRIEDEXT01.LFP')
>
> > changed = parsed.inject(Array.new) do |rows, row|
> >    if row[2] == "C" and (d_row = rows.reverse.find { |r| r[2] == "D" })
> >            d_row[2] = "P"
> >    end
> >    rows << row
> > end
> > puts changed.map { |r| r.to_csv }
>
> Hope that helps.
>
> James Edward Gray II