Hi --

On Sun, 23 Jul 2006, kublaikhan55 / hotmail.com wrote:

> Hi,
> I have a csv delimited file that I'd like to 'insert into some_table
> table values ...' file. Thus I have a file where each row is of the
> sort:
>
> value1, value2, value3, value4
>
> and I'd like to convert the file into a file where each row looks
> like::
>
> insert into some_table values (value1, value2, value3, value4)
>
> How may I efficiently do this?

Assuming you don't have to do any massaging or escaping of the values,
you could do something like:

ruby -ne \
'puts "insert into some_table values (#{$_.chomp});"' old > new


David

-- 
http://www.rubypowerandlight.com => Ruby/Rails training & consultancy
http://www.manning.com/black     => RUBY FOR RAILS (reviewed on
                                     Slashdot, 7/12/2006!)
http://dablog.rubypal.com        => D[avid ]A[. ]B[lack's][ Web]log
dblack / wobblini.net              => me