Parsing a fixed column text file in sed

I have a text file with records of the form:

A X1 Y1 X2 Y2 X3 Y3  

where A is character length 10, Xi is character length 4 and Yi is numeric length 10.

I want to parse the line, and output records like:

A X1 Y1
A X2 Y2
A X3 Y3
etc

Can anyone please give me an idea of how to do this. Thanks.

Is your input space delimited? You can loop over the fields starting on field 2 with increments of 2 and print the first field and the current field plus its right hand neighbor...

If it is fixed width you can call substring functions to specify the fields...

please check this ,

$cat a
A X1 Y1 X2 Y2 X3 Y3
$awk '{ i=1 ; while (i< NF) {printf("%s ",$1);i++;printf("%s ",$i);i++;printf("%s\n",$i)} }' a
A X1 Y1
A X2 Y2
A X3 Y3

I find it very hard to reconcile your statements (A is character length 10) with ("A" which is length 1); (Xi is character length 4) with ("X1", "X2", and "X3" which are all length 2); and (Yi is numeric length 10) with ("Y1", "Y2", and "Y3" which are all length 2 and none of them are numeric).

Please show us a sample input file that contains real data (or fake data that matches the format of your real input file(s)) and the actual output that you are trying to produce from that sample input file. And, use CODE tags for both the sample input and the desired output.

Hope I understand correctly. From the
input:

0123456789abcd1234567890ABCD1234567890xyz01234567890ABCD1234567890
sed -n '
:L
h
s/\(.\{10\}\)\(.\{4\}\)\(.\{10\}\).*/\1 \2 \3/p
g
s/\(.\{10\}\)\(.\{4\}\)\(.\{10\}\)/\1/
tL
' input

produces the output:

0123456789 abcd 1234567890
0123456789 ABCD 1234567890
0123456789 xyz0 1234567890
0123456789 ABCD 1234567890