Hi, I am trying to replay multiple log files and dump table contents to disk as .csv files. /I can replay log using: -11!`sym2015.07.98 /Get all tables using t: system “a” Save t This saves files as binary. How do I get it to save csv format?
t:system"a"
save hsym `$(string t),:“.csv”
Jason
You could try something like below:
q)t:(a:1 2 3;b:3 4 5)
q)save `:t.csv
`:t.csv
q)read0[`:t.csv]
“a,b”
“1,3”
“2,4”
“3,5”
Does this help?
The disadvantage of this approach is that the table name is bound to the file name but this can be overcome.
Ross
You can do something like this:
{ 0:[`$“:”,string,“.csv”;] 0:[“,”;] value x } each tables
or for a single table:
0:[`:table1.csv;] 0:[“,”;] table1
The first 0: converts the table into text separated by comma, the second writes out to table1.csv.
Note that you can do more interesting things like:
{ 0:[`$“:”,string,string[y],“.csv”;] 0:[“,”;] value x }[;.z.d] each tables
if you wanted to append today’s date (.z.d) to each csv.
/Mark