while read -n1 _ read -n1 b read -n1 c read -n2 d read _ [ $b = $c ]&&echo $b||echo $d end