Skip to content

Instantly share code, notes, and snippets.

@rizalgowandy
Created January 6, 2020 08:27
Show Gist options
  • Save rizalgowandy/71ee7ce7274767a3ef90d873c554d72a to your computer and use it in GitHub Desktop.
Save rizalgowandy/71ee7ce7274767a3ef90d873c554d72a to your computer and use it in GitHub Desktop.
redis-cli keys "*" > keys
cat keys | xargs -n 1 -L 1 redis-cli ttl > ttl
paste -d " " keys ttl | grep .*-1$ | cut -d " " -f 1 > without_ttl
# We can create a script for deleting the keys
cat without_ttl | awk '{print "redis-cli del "$1}' > redis.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment