Saving Redis query output to file

xavi picture xavi · Nov 2, 2015 · Viewed 29.1k times · Source

Using redis-cli I connected to specific server:

redis-cli -h 10.1.xx.xx

And select 1

Then just to get list of one key features:

KEYS data_column*

THis will print list of that column values on command line. However, there are like quite many values, I want to save query output to file.

In general, using > file_name after the command works. But in this case, it does not work, as its on redis server, though from command line. How to save such query result?

Answer

Didier Spezia picture Didier Spezia · Nov 2, 2015

Simply use:

./redis-cli -h 10.1.xx.xx -n 1 keys 'data_column*' >file.txt