Redis-cli --csv 选项(导出到 csv) [英] Redis-cli --csv option (exporting to csv)
问题描述
我想将我在从站上的 Redis 数据的一个子集导出到一个 csv 文件.我注意到 redis-cli 中添加了一个新的 csv 输出选项,但我无法找到有关其工作原理的文档.启用该选项会将命令输出以 csv 格式打印到屏幕上.将其放入 csv 文件的最佳方法是什么?
I would like to export a subset of my Redis data on the slave to a csv file. I notice a new csv output option was added to redis-cli but I am unable to find documentation of how it works. Enabling the option prints the command outputs to screen in csv format. What is the best way to get this into a csv file?
推荐答案
前沿!
我刚刚查看了 源代码 &它所做的只是将命令作为逗号分隔值输出到标准输出.这不足为奇.
I've just looked at the source code & all it does is output the commands as comma separated values to stdout. Which is no big surprise.
因此,您可以按照标准方式将其重定向到一个文件,只要你在 Linux 上?
So you could just redirect it to a file, in the standard way, as long as you're on Linux?
例如/
redis-cli --csv your-command > stdout.csv 2> stderr.txt
这篇关于Redis-cli --csv 选项(导出到 csv)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!