I have a kx compiler installed in linux,i need to convert a qbin file to csv format using this compiler.How feasible is this compiler in doing so?I had already did the conversion using DeltaControl and it has all inbuilt libraries and functions so it was easy doing in DeltaControl.
Hi Abhra,
q will be able to handle reading csv files:
q)t: get `:t
q)t
a b
-------------
namk 3425.698
nkfj 4950.533
bfde 3600.46
q)save `t.csv
`:t.csv
jburrows@server:~$ head -4 t.csv
a,b
namk,3425.698
nkfj,4950.533
bfde,3600.46
I could do this in one go, without intermediate loading and assigning by using 0: and csv :
:t.csv 0: csv 0:get
:t
It is important to note here that this works as long as none of the columns in this table are nested lists. Assuming a simple data structure, you could use ungroup on these:
q)t2
a b c
-------------------
igkh 9047.183 a b c
lemn 4629.045 d e f
q)`:t2 set t2
`:t2
q)t2: ungroup get `:t2
q)t2
a b c
---------------
igkh 9047.183 a
igkh 9047.183 b
igkh 9047.183 c
lemn 4629.045 d
lemn 4629.045 e
lemn 4629.045 f
q)save `t2.csv
`:t2.csv
jburrows@server:~$ head -4 t2.csv
a,b,c
igkh,9047.183,a
igkh,9047.183,b
igkh,9047.183,c
Hope this helps,
James