Skip to content

Instantly share code, notes, and snippets.

@boriska70
Last active May 14, 2023 21:20
Show Gist options
  • Save boriska70/c82314ca05492354c20e7fdc24044a0e to your computer and use it in GitHub Desktop.
Save boriska70/c82314ca05492354c20e7fdc24044a0e to your computer and use it in GitHub Desktop.

Revisions

  1. boriska70 revised this gist May 14, 2023. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion redis-in-shell
    Original file line number Diff line number Diff line change
    @@ -5,6 +5,9 @@ for key in $(redis-cli -h hostname.com keys "pat:tern:*"); do
    keys="$keys"" ""$key"
    done

    redis-cli -h hostname.com mget $(echo $keys) | sort | uniq -c
    redis-cli -h hostname.com mget $(echo $keys) > values_1405

    cat values_1405 | sort | uniq -c
    echo $keys | tr " " "\n" | wc -l
    echo $keys | tr " " "\n" > keys_1405
    paste keys_1405 values_1405 > result_1405
  2. boriska70 created this gist May 14, 2023.
    10 changes: 10 additions & 0 deletions redis-in-shell
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    ##### Get values by pattern and group by

    export keys=""
    for key in $(redis-cli -h hostname.com keys "pat:tern:*"); do
    keys="$keys"" ""$key"
    done

    redis-cli -h hostname.com mget $(echo $keys) | sort | uniq -c

    echo $keys | tr " " "\n" | wc -l