splitting long string into several lines?

I'm using a barcode scanner to grab ISBNs. Unfortunately, short of hitting "enter" each time (not easy while on a ladder), there's no good way to split it up. So I scanned it into a series of long lines in notepad.

Now, I need to split each line into 12-number lines.
instead of:

111111111111222222222222333333333333444444444444
555555555555
666666666666777777777777

I want:

111111111111
222222222222
333333333333
444444444444
555555555555
666666666666
777777777777

Anybody have an easy way? I guess I could use CUT several times, but given the length of each line (several hundred characters, maybe more) I figure there's a better way to do it, probably SED or the like.

Tried looking on usenet, but using google groups to find the appropriate group is a pain.

Thanks in advance.

fold -w12 infile

Awesome! I'll give it a shot. Many thanks!

Friend came up with this. More complex version: fed a series of numbers, after a pause it will force a new line. For the scanner I used, works like a charm.

#!/bin/bash

READFLAG=0;
char="";
EXIT="";

while [ 1 :]; do
read -t1 -n1 char
if [ "$?" == "0" :]; then
echo -n $char;
READFLAG=1;
# echo "readflag is $READFLAG";

elif [ "$READFLAG" -eq "1" :]; then
echo "" # endline to out
echo -e '\a' # bell to notify we are ready
READFLAG=0;
# echo "readflag is $READFLAG";
fi
done

And for a few more cases -

$
$
$ cat barcodes
111111111111222222222222333333333333444444444444
555555555555
666666666666777777777777
888
8
88
88
8
888
99
99
99
 
 
99
99
99
$
$ perl -ne 'chomp; $x .= $_; if (length($x) >= 12){ do{$x=~/^(.{12})(.*)$/ and print $1,"\n" and $x=$2} until (length($x)<12) }' barcodes
111111111111
222222222222
333333333333
444444444444
555555555555
666666666666
777777777777
888888888888
999999999999
$
$

tyler_durden