awk -F , -v acct=root 'NR==FNR { h[$1]++; next; } { if($1 == "") $1=host; host=$1; if (! h[$1]) next; if ($2 == acct) print }' fileb filea