perl -ne "$i++ || binmode(STDOUT);chomp;print pack(q/B*/,$_);" infile >outfile