# sed -e 'N;h' -e 's/. . . . . \(.\) .\n. . . . . \(.\) .*$/\1\2/' -e '/1$/x;s/.*\n\(.*\)/\1/' -e '/^1/x;s/\(.*\)\n.*/\1/' infile \
> |sed -e '$h' -e '/. . . . . \(.\) .\1/x;!s/11.*//' -e '/^$/d' -e '/^[^1]*$/d'
a b c d e 1 e
a b c d e 1 w
a b c d e 1 t
# cat infile
a b c d e 1 e
a 1 c d e 3 f
a b c 1 e 8 h
a b c d e 1 w
a 1 c d e 2 w
a b c d e 1 t
a b c d e 7 4