Now it is not a function to be able to do it in one shot (see comments in the DEL documentation ). Unfortunately, you only stay with KEYS , scrolling through the results, and then using DEL to delete each one.
How to use bash a bit to help?
for key in `echo 'KEYS user*' | redis-cli | awk '{print $1}'` do echo DEL $key done | redis-cli
To get through it:
echo 'KEYS user*' | redis-cli | awk '{print $1}' echo 'KEYS user*' | redis-cli | awk '{print $1}' - get all the keys and cross out the excess text that you don't want with awk.echo DEL $key - create an echo statement for each of them to remove it.| redis-cli | redis-cli - take DEL statements and pass them back to cli.
Do not indicate that this is the best approach (you may have some problems if some of your usernames have spaces in them, but hopefully you understand).
Donald Miner Jan 10 2018-12-12T00: 00Z
source share