Require script to create two files

Hi folks,

I have a input.file with the following contents:-

flor
geor
enta
vpal
domi
pegl
cars
mted
four
rose
annc
gabi
ward
dalv
elph
beac
qtwn
jame
gabr
rivl
birc
radi
grey
mark
mast
entr
hunt
rivr
doms
domr
vpsc

I want to break this up into two output files. The sequence is very important. The 1st record can go to any output file as long as the next record goes to the opposite file.

Example,
Output.FileA will look like:-
flor
enta
domi
cars
four
annc
ward
elph
qtwn
gabr
birc
grey
mast
hunt
doms
vpsc

Output.FileB will look like:-
geor
vpal
pegl
mted
rose
gabi
dalv
beac
jame
rivl
radi
mark
entr
rivr
domr

Any script guru to help with this?

Can you show us what you've tried so far?

This should work

while read LINE
do
    echo "$LINE" > Output.FileA
    read LINE && echo "$LINE" > Output.FileB
done
nawk 'BEGIN{file0="a.txt";file1="b.txt"}
{
tmp=NR%2
file=sprintf("file%s",tmp)
print $0 >> file
}' a.txt
awk '{print > "a.txt" ; getline; print > "b.txt"}' urfile

:b::b::b:

Another one:

awk '{print > "file_"NR%2}' file

This is my long winded attempt at it. I finally got it to work. Thanks to all the guy's who supplied the simpe short solution. I will use one of them.

cnt=1
linecnt=1
for i in `cat input.file`
do
if [ $linecnt = $cnt ]
then
echo $i output.filea
let cnt=$cnt+1
else
echo $i output.fileb
let linecnt=$linecnt+1
fi
done

Try:

xargs -n2 <file | while read line1 line2; do echo "$line1">>file1; echo "$line2">>file2; done