you can use awk
Code:
awk -v file="Prac1" ' BEGIN { # get all sids of Prac1 into array
while( (getline line < file )>0 ) {
if (line ~ /^#/ ) continue #skip comments
mprac[line]
}
}
/^#/ {next} #skip comments line in Students file
{
if (!( $1 in mprac )) {
print "Sid: " $1 " not in " FILENAME
}
}
' "Students"