In my redis database, I’m trying to delete a series of keys that start with:
EPOCH_vgsOwnedVehs_
I have tried the following:
redis-cli -h 127.0.0.1 -p myport -a mypassword --scan --pattern EPOCH_vgsOwnedVehs_* | xargs redis-cli unlink
and
redis-cli -h 127.0.0.1 -p myport -a mypassword --scan --pattern EPOCH_vgsOwnedVehs_* | xargs redis-cli -h 127.0.0.1 -p myport -a mypassword unlink
But, I get the following error message:
'xargs' is not recognized as an internal or external command, operable program or batch file.
Could anyone help as to why xargs won’t work in this case? I see that same syntax above being mentioned quite a few times here and seems to work for others…
EDIT: I forgot to mention that when I run the first half of the line before the pipe, it does return all the keys that match the criteria.
2
Answers
The following should do the work; (added an example print-out)
xargs
is a common Linux utility and the message you are seeing indicates you are using Windows. You have a couple of choices here to get this working – you can find a Windows alternative ofxargs
, use Cygwin, use Powershell, etc.