by dancek · 8y ago · 0 comments
But a lot of the use cases these other tools are good for are small tasks every now and then. I feel kdb+ is in a different category.
For example, removing nonconsecutive, duplicate lines from a file, such as a CSV file:
exec echo "k).Q.fs[l:0::\`:$1];l:?:l;\`:$1 0:l"|exec q >&2;
where Q.fs is a function in a script thats bundled with the interpreter; the chunk size for reading the file into memory is adjustable by editing the function. l:0;.Q.fs[{if[x~l;:];-1 l::x}each]`:input
or if you have memory: -1 distinct read0`:input
...or if you want to use k: -1@?0:`:input