Has anyone got a neat way of redirecting output from nsscon into a file?

I am trying to get some statistics on memory use, etc. and would like a script to cron that will run various memory related command and output to a timestamped log file for comparison...

Something like:

echo -e 'c\ncachestats\nC\n\nexit' | nsscon > file.out

is what I am after, but this stuffs a load of formating escape sequences in there. I also tried piping through 'col', and that gets rid of some, but not all.

I see from the supportconfig script that they use some sort of pipe to sed, but I'm not sure what or how this works...

Any pointers?