awk print the next line on the current line

Ok I have a file with hundreds of lines, four columns, space delimited, TESTB.TXT for example
TESTB.TXT
---

AA ZZ 12 34
BB YY 56 78
CC XX 91 23
DD VV 45 67

---

I want a new file that has 7 columns, the first four are identical, and the next 3 are the last three of the next line...so for example
TESTB2.TXT
---

AA ZZ 12 34 YY 56 78
BB YY 56 78 XX 91 23
CC XX 91 23 VV 45 67
DD VV 45 67

---

I hope I typed that right and I hope the pattern is obvious. Obviously the last line of the file wont have a next line, so its last3 columns are blank. no problem there. or if you know of a similar script just point me to it and I'll hack out the details.

$[/tmp] > more test.txt
AA ZZ 12 34
BB YY 56 78
CC XX 91 23
DD VV 45 67

$[/tmp] > echo "" > test1.txt
$[/tmp] > more test1.txt

$[/tmp] > cat test1.txt test.txt > test2.txt
$[/tmp] > more test2.txt

AA ZZ 12 34
BB YY 56 78
CC XX 91 23
DD VV 45 67

$[/tmp] > cat test.txt | awk '{print $2 " " $3 " " $4}' > test3.txt
$[/tmp] > more test3.txt
ZZ 12 34
YY 56 78
XX 91 23
VV 45 67

$[/tmp] > paste test2.txt test3.txt > test4.txt
$[/tmp] > more test4.txt
ZZ 12 34
AA ZZ 12 34 YY 56 78
BB YY 56 78 XX 91 23
CC XX 91 23 VV 45 67
DD VV 45 67

With awk:

awk ' 
NR==1{printf("%s", $0);next}
{print FS $2,$3,$4;printf("%s", $0)}
END{if(!(NR%2)){print ""}}
' file

Regards

the paste command will work! thats perfect. I did not even know about the paste command. thank you!

awk 'END{print __}{_=__}{__=$0;$1=_}_' file

Use nawk or /usr/xpg4/bin/awk on Solaris.

chek it this!

awk '{ print last,$0; last=$0 }' file.txt

Usefull.