awk -F'|' 'FNR==NR{a[$2]=$2;b[$3]=$3;next};{if($2 in a){print $0 > "new_file_1"};if(($2 in a )&& !($3 in b)){print $0 > "new_file_2"}} file1 file2
detalhes ...
{if($2 in a){print $0 > "new_file_1"} : if SID in file2 matches SID in file1 redirect to a file called new_file_1
..
if(($2 in a )&& !($3 in b)){print $0 > "new_file_2"} :if SID in file2 matches SID in file1 but CIDs does not match, redirect to a file called new_file_2