0

I'm doing some validations on Redis using redis-cli with the following command

redis-cli --scan --pattern XXX:YYY:* | sort

XXX:YYY:126
XXX:YYY:13
XXX:YYY:1369
XXX:YYY:139
XXX:YYY:15
XXX:YYY:16
XXX:YYY:1657
XXX:YYY:17
XXX:YYY:2341
XXX:YYY:2349
XXX:YYY:2353
XXX:YYY:2725
XXX:YYY:2825
XXX:YYY:2837
XXX:YYY:2894
XXX:YYY:2925
XXX:YYY:2933
XXX:YYY:3699
XXX:YYY:4219
XXX:YYY:4227
XXX:YYY:4247
XXX:YYY:4451
XXX:YYY:4475
XXX:YYY:4555

However, I need to take specific keys for example

XXX:YYY:3699
XXX:YYY:4475
XXX:YYY:1657

Is it there a way to still use the initial pattern and do something like

XXX:YYY:* AND (*3899 OR *4475 OR 1657)

thanks

Ersoy
  • 8,816
  • 6
  • 34
  • 48
Luis Urea
  • 107
  • 3
  • 12
  • See if this helps: https://stackoverflow.com/questions/36863037/how-to-apply-or-condition-in-redis-keys-command – shmsr Jun 08 '20 at 12:17

1 Answers1

1

You may use grep for it, there are several patterns here

redis-cli --scan --pattern XXX:YYY:* | sort | grep -e '3699\|4475\|1657'

this will print

XXX:YYY:1657
XXX:YYY:3699
XXX:YYY:4475
Ersoy
  • 8,816
  • 6
  • 34
  • 48