I can only test it under Linux at the moment, but your code should work:
: MYDIR$ z" ls -l /proc > /tmp/test.txt" ; okMYDIR$ >shell okcr z" cat /tmp/test.txt | tail -n 3" >shell-r-------- 1 root root 0 Nov 10 12:19 vmallocinfo-r--r--r-- 1 root root 0 Nov 10 12:19 vmstat-r--r--r-- 1 root root 0 Nov 10 12:19 zoneinfo
Can you try writing the file to another directory? Maybe you don't have permission to write directly on C: