I want get value by redis-cli keys
This is work
redis-cli keys number_* | xargs redis-cli del
But this is not work
redis-cli keys number_* | xargs redis-cli get
The difference between DEL and GET, in this context, is that the former is variadic (i.e. accepts one or more arguments) whereas the latter isn't (one and only one key name is expected).
To solve this you can choose one of the following:
-L switch with xargs, i.e.: redis-cli keys number_* | xargs -L 1 redis-cli getMGET, i.e.: redis-cli keys number_* | xargs redis-cli mgetKEYS is a dangerous command as it may block the server for a long time - do not use it in production!