Reputation: 148
I am trying to execute query redis-cli --raw keys "$xx" | xargs redis-cli del
but getting error.
ERR wrong number of arguments for 'del' command
Upvotes: 2
Views: 7847
Reputation: 23161
Try this instead, to wrap the key in quotes:
redis-cli keys "pattern" | xargs -I% redis-cli del "%"
This takes each key as a variable, %
, and passes it to redis-cli del
but wraps it in double quotes in case it contains non-alphanumeric characters (like period,colon,etc.)
Upvotes: 4
Reputation: 3380
Check what redis-cli --raw keys "$xx"
is returning: you'll see that error when you call redis-cli del
without any arguments.
Upvotes: 1