perl -ne 'push@{($|?"_0":"_1")},$_;eof&&$|++;END{$,=$?||map{print$_1[$-++],$_}@_0}' file1 file2