On Friday 02 August 2002 10:14 am, Khurram wrote:
> Hi all,
>
> I'm trying to modify a file that has tab delimited fields.  I want
> to modify the 4th field within each row.  I can get to the field I
> want by using the "split" function operating on \t delimiter... but
> this function returns an array right?  It doesn't return a pointer
> to the fields?
>
> So if it doesn't return a pointer then how can I modify the field
> within the file easily?
>
> a = File.open("blah.txt")
> f = (a.gets).split(/\t/)
> f[4] = f[4] + "blah"
> .... what do I do after this?  How can I write the value back out
> to the file?

f.join("\t")

will re-construct the array into a string.

-- 
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE