Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /bin/bash
- set -e
- set -u
- # redis-cli --raw FLUSHALL >/dev/null 2>%1; # uncomment to clear the database
- function hash () {
- printf %s "$1" | md5sum | cut -f1 -d' '
- }
- # file 1
- cat "$1" | while read -r line; do
- hash $line | { read hash; redis-cli --raw SET $hash 1 >/dev/null 2>&1; }
- done
- # file 2
- cat "$2" | while read -r line; do
- RESULT=$(hash $line | { read hash; redis-cli --raw GET $hash; })
- if [[ -z "$RESULT" ]]; then
- printf "%s\n" "$line"
- fi
- done
- # redis-cli --raw FLUSHALL >/dev/null 2>%1; # uncomment to clear the database
Add Comment
Please, Sign In to add comment