'running a system command in kdb

I am trying to run the command in kdb but it does not work. I knew it may be associated with some special character and I am trying to put the [] to escape but still does not work.

system "awk '/^Mem/ {print $2}' <(free -m)"

I tried

system "awk '/[^]Mem/ {print $2}' <(free -m)"  - not working

any input would be appreciated.

kdb


Solution 1:[1]

You can avoid a system call as kdb+ can return the physical memory available using .Q.w[]

q)floor (.Q.w[]`mphy)%1024 xexp 2
28072
\\
$ awk '/^Mem/ {print $2}' <(free -m)
28072

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1