Received: by 10.101.131.33 with SMTP id i33mr219630ann.26.1253269456875; Fri, 18 Sep 2009 03:24:16 -0700 (PDT)Date: Fri, 18 Sep 2009 03:24:16 -0700 (PDT)X-IP: 203.116.57.169User-Agent: G2/1.0X-Google-Token: ZKfpcwwAAABSDujEFs5oW7fJtjg5JYfXX-HTTP-Via: 1.1 siproxy2.mlp.com:3128 (squid/2.6.STABLE20)X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729),gzip(gfe),gzip(gfe)Message-ID: <75148864-e908-44ec-99f7-023fd386a5ce@g1g2000vbr.googlegroups.com>Subject: Save a result from table in a csv file for outputFrom: minh To: “Kdb+ Personal Developers” X-Google-Approved: charlie@kx.com via web at 2009-09-18 16:21:42Hi,I want to Save a result from table in a csv file for output.the name of my table is a simple table with date and pxwhen i save in the file res_ma.csv, I have the error type
:res_ma.csv 0: res_maCan somebody guide me how to save these data in a file?Thanks a lot MinhSee below:q)tabledate px----------------------7/13/2009 17:00 98.817/13/2009 16:30 98.817/13/2009 16:00 98.805…q) px_series:select px from tablepx------98.8198.8198.805…q)res_ma:mavg[25;px_series]q) `:res_ma.csv 0: res_ma’type
X-Mailer: Apple Mail (2.936)> I want to Save a result from table in a csv file for output.“save” will do this automagically% qKDB+ 2.6 2009.09.15 Copyright (C) 1993-2009 Kx Systemsm32/ 2()core 2048MBq)t:(a:1 2 3)q)savet.csv
:t.csvq)\% cat t.csva123
User-Agent: G2/1.0X-Google-Token: luYqnwwAAADUv5km-nkJql5bFZMrUP3iX-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.13) Gecko/2009080315 Ubuntu/9.04 (jaunty) Firefox/3.0.13,gzip(gfe),gzip(gfe)Message-ID: <3e816858-cb1e-4dcc-ad54-c3250e5be513@h30g2000vbr.googlegroups.com>Subject: Re: Save a result from table in a csv file for outputFrom: Kurt Kretzer <kurt.kretzer>To: “Kdb+ Personal Developers” X-Google-Approved: charlie@kx.com via web at 2009-09-18 20:46:57You can also use this method:q):anyfilename.csv 0: "," 0: tableThe first use of 0: (with the "," as the left arg) turns the tableinto a list of csv strings, and then the second use of 0: writes thecsv strings to the file. The save command is easier, but the abovemethod a) lets you give the file any name you want, and b) will alsowork on local table variables within a function (save only works forglobal tables).On Sep 18, 12:28?pm, Aaron Davies <aaron.dav...> wrote:> > I want to Save a result from table in a csv file for output.>> "save" will do this automagically>> % q> KDB+ 2.6 2009.09.15 Copyright (C) 1993-2009 Kx Systems> m32/ 2()core 2048MB>> q)t:([]a:1 2 3)> q)save
t.csv> `:t.csv> q)\> % cat t.csv> a> 1> 2> 3</aaron.dav…></kurt.kretzer>
Hi Kurt, Aaron,Thanks for your usefull feedbacks.This works perfectly.Have a great dayMinhOn Sep 19, 4:39?am, Kurt Kretzer <kurt.kret…> wrote:> You can also use this method:>> q):anyfilename.csv 0: "," 0: table>> The first use of 0: (with the "," as the left arg) turns the table> into a list of csv strings, and then the second use of 0: writes the> csv strings to the file. ?The save command is easier, but the above> method a) lets you give the file any name you want, and b) will also> work on local table variables within a function (save only works for> global tables).>> On Sep 18, 12:28?pm, Aaron Davies <aaron.dav...> wrote:>>>> > > I want to Save a result from table in a csv file for output.>> > "save" will do this automagically>> > % q> > KDB+ 2.6 2009.09.15 Copyright (C) 1993-2009 Kx Systems> > m32/ 2()core 2048MB>> > q)t:([]a:1 2 3)> > q)save
t.csv> > `:t.csv> > q)\> > % cat t.csv> > a> > 1> > 2> > 3- Hide quoted text ->> - Show quoted text -</aaron.dav…></kurt.kret…>
Date: Sat, 19 Sep 2009 10:57:09 -0400Message-ID: <32bf96e80909190757p424b2ca0g50f9e492f745a1cc@mail.gmail.com>Subject: Re: [personal kdb+] Re: Save a result from table in a csv file for outputFrom: Tim Rieder To: “personal-kdbplus@googlegroups.com” One thing to keep in mind is that nested character columns (strings)are automatically escaped if they contain commas, but in the rareevent you have a symbol column with a comma, it will not be escaped.To avoid problems convert sym columns to strings if you think they maycontain commas.On Sep 18, 2009, at 4:39 PM, Kurt Kretzer <kurt.kretzer>wrote:>> You can also use this method:>> q):anyfilename.csv 0: "," 0: table>> The first use of 0: (with the "," as the left arg) turns the table> into a list of csv strings, and then the second use of 0: writes the> csv strings to the file. The save command is easier, but the above> method a) lets you give the file any name you want, and b) will also> work on local table variables within a function (save only works for> global tables).>> On Sep 18, 12:28 pm, Aaron Davies <aaron.dav...> wrote:>>> I want to Save a result from table in a csv file for output.>>>> "save" will do this automagically>>>> % q>> KDB+ 2.6 2009.09.15 Copyright (C) 1993-2009 Kx Systems>> m32/ 2()core 2048MB>>>> q)t:([]a:1 2 3)>> q)save
t.csv>> `:t.csv>> q)\>> % cat t.csv>> a>> 1>> 2>> 3>> ></aaron.dav…></kurt.kretzer>