#!/usr/bin/ruby # frozen_string_literal: true require "redis" redis = Redis.new raise "GIVE ME FILE" unless ARGV[0] PORTING_NUMBERS = File.read(ARGV[0]).split("\n") redis.scan_each(match: "catapult_jid-*", count: 1000) do |key| tel = key[13..-1] next if PORTING_NUMBERS.include? tel jid = redis.get(key) next if jid.start_with?("customer_") other_tel = redis.lindex("catapult_cred-#{jid}", -1) next unless other_tel next unless tel == other_tel puts jid end