while read l;do test ${l:1:1} = ${l:2:1}&&echo ${l:1:1}||echo ${l:4:1} done