Forked from MattSurabian/redis-one-line--pattern-delete.sh
Last active
July 5, 2017 13:45
-
-
Save joshp123/58fb4d0291a07fa554c5c13366ca2980 to your computer and use it in GitHub Desktop.
One liner for deleting based on a pattern in redis. KEYS supports wildcards, delete/get/etc doesn't. No worries xargs to the rescue.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
redis-cli -h <HOST> -p <PORT> KEYS "<PATTERN>" | xargs -i% redis-cli -h <HOST> -p <PORT> DEL % | |
#easy mmode: | |
redis-cli KEYS "<pattern>" | xargs -i% redis-cli GET % |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment