Solutions to what I'll call Mochel's Conundrum. The problem: Given a file, concatonate 2 concurrent lines into 1. Example: a b c d e g h i j k becomes: a b c d e g h i j k Solutions: while read xx do if [ -z $line ] then line=$xx else echo $line $xx line='' fi done if [ $line ] then echo $line fi # other shell answer while read xx do read yy echo $xx ${yy} done < foo.txt # here's the perl equivalent open(FILE,"foo.txt"); while() { chomp; print $_ . " " . ; } print "\n"; close FILE; # One line answers sed ':1~2:a;N;s/\n/ /g' foo.txt xargs -l2 < foo.txt # Inaky's 1 liner awk '{printf("%s ", $0); getline; print}' foo.txt Bugfix to the above: awk '{printf("%s ", $0); if (getline) { print } }' foo.txt # Jesse's short perl 1 liners perl -pe 'chomp; $_ .= " " . <>' < foo.txt perl -pe 's/\n/" " . <>/e' < foo.txt