Adjust format file

Hi all...

i have a question, and i don`t know what to do ... i have a flat file what is separated by ";" and i need format it... here is an example:

this is what i have:

AAA ; BBB ; 1 ; 1.1 ; 1.2 ; 1.3 ; 2 ; 2.1 ; 2.2 ; 2.3 ; 3 ; 3.1 ; 3.2 ; 3.3 ; .......
.........

there are a lot of columns and lines (records), and i need this output:

AAA ; BBB; 1 ; 1.1 ; 1.2 ; 1.3
AAA ; BBB; 2 ; 2.1 ; 2.2 ; 2.3
AAA ; BBB; 3 ; 3.1 ; 3.2 ; 3.3
..........

is that possible?
any idea, thanks..

Hi,
This is not very clean, but will work if there are always six fields per line in the output.

if you can have something different post back

Gaurav

i run it and i have the next error message:

code:

cat f1.txt | awk -F ';' '{
for (i=3;i<NF;i++)
{
j=i+1
k=i+2
l=i+3
printf("%s;%s;%s;%s;%s;%s",$1,$2,$i,$j,$k,$l)
print ""
i=i+3
}
}'

message error:

awk: syntax error near line 1
awk: bailing out near line 1

why? who can explain it please...
any idea, thanks

nawk -f deb.awk myFile.txt

deb.awk:

BEGIN {
  div=4
  FS=OFS=";"
}
{
  for(i=3; i <= NF; i+=div)
    print $1, $2, $i, $(i+1), $(i+2), $(i+3)
}

Hi ,
Its working fine for me

Gaurav