2

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

1
  • Hi, select needed key in fastoredis.com and press del Commented Mar 3, 2019 at 13:18

2 Answers 2

4

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.)

Sign up to request clarification or add additional context in comments.

Comments

1

Check what redis-cli --raw keys "$xx" is returning: you'll see that error when you call redis-cli del without any arguments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.