公告
财富商城
积分规则
提问
发文
2019-01-21 21:21发布
我想做一个坏孩纸
I want to remove keys that match "user*".
how do I do that in redis command line?
When using the oneliner, you can edit the pattern in case it escapes specific characters. For instance, to delete patterns like '\b test \b' use:
redis-cli --raw KEYS '\\b*' | sed 's/\\b/\\\\b/g' | xargs redis-cli del
Using awk, find all matching keys from redis using redis-cli KEYS command and pipe to redis-cli DEL command.
awk
redis-cli KEYS
redis-cli DEL
redis-cli KEYS "user*" | awk '{ system("redis-cli DEL " $1) }'
最多设置5个标签!
When using the oneliner, you can edit the pattern in case it escapes specific characters. For instance, to delete patterns like '\b test \b' use:
Using
awk
, find all matching keys from redis usingredis-cli KEYS
command and pipe toredis-cli DEL
command.