From: kublaikhan55@... Date: 2006-07-24T04:40:11+09:00 Subject: Re: converting a text file into an "insert into ..." file This one-liner works for me very well. Thank you. gk Jan Svitok wrote: > In case you need escaping there is a module for parsing CSV in stdlib. > http://www.ruby-doc.org/stdlib/libdoc/csv/rdoc/index.html > > otherwise just > > ruby -ne 'puts "insert into some_table values (#{$_.strip});"' < data.csv > > On 7/23/06, 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? > > > > Thanks for your help. > > gk > > > > > >