Skip to content

Instantly share code, notes, and snippets.

@arodbits
Last active May 18, 2018 19:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arodbits/29c77b030e541deddc7db61607f29fa8 to your computer and use it in GitHub Desktop.
Save arodbits/29c77b030e541deddc7db61607f29fa8 to your computer and use it in GitHub Desktop.
Store in a sorted set in Redis all unique values from keys matching a pattern using a shell command
redis="redis-cli -h host_name" \
$redis keys "*matching_key_pattern*" | awk -F':' '{print $2}' | awk '!x[$0]++' | xargs -I{} $redis zadd temp-user_ids {} {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment