Could someone give me some help on restructuring a data file?
My input and desired output is as follows:
10 1 0000 0000
10 3 0005 0005
10 4 0010 0015
10 6 0020 0015
10 7 0025 0025
11 1 0040 0005
11 2 0045 0005
11 3 0050 0005
11 4 0055 0005
12 8 0010 0005
13 1 0020 0005
13 3 0030 0005
14 -10 0040 0005
14 -8 0050 0005
15 999 0060 0005
would become
10 1 0000 0000
10.1 3 0005 0005
10.1 4 0010 0015
10.2 6 0020 0015
10.2 7 0025 0025
11 1 0040 0005
11 2 0045 0005
11 3 0050 0005
11 4 0055 0005
12 8 0010 0005
13 1 0020 0005
13.1 3 0030 0005
14 -10 0040 0005
14.1 -8 0050 0005
15 999 0060 0005
What I am trying to accomplish is:
1. Check if current record is same or different than previous record on field 1.
If it is different write fields $1 - $4
If it is same on field 1 as previous record check the field 2 for gaps in number. The field 2 can be incrementing or decrementing.
If the field 2 gap is more than a pre-defined variable of 1 in this case, the gap would dictate a rename of the field 1 with a decimal 1-number suffix. I may have several gaps in field 2 that would require numerous field 1 extensions.
Thanks for any assistance.
My input and desired output is as follows:
10 1 0000 0000
10 3 0005 0005
10 4 0010 0015
10 6 0020 0015
10 7 0025 0025
11 1 0040 0005
11 2 0045 0005
11 3 0050 0005
11 4 0055 0005
12 8 0010 0005
13 1 0020 0005
13 3 0030 0005
14 -10 0040 0005
14 -8 0050 0005
15 999 0060 0005
would become
10 1 0000 0000
10.1 3 0005 0005
10.1 4 0010 0015
10.2 6 0020 0015
10.2 7 0025 0025
11 1 0040 0005
11 2 0045 0005
11 3 0050 0005
11 4 0055 0005
12 8 0010 0005
13 1 0020 0005
13.1 3 0030 0005
14 -10 0040 0005
14.1 -8 0050 0005
15 999 0060 0005
What I am trying to accomplish is:
1. Check if current record is same or different than previous record on field 1.
If it is different write fields $1 - $4
If it is same on field 1 as previous record check the field 2 for gaps in number. The field 2 can be incrementing or decrementing.
If the field 2 gap is more than a pre-defined variable of 1 in this case, the gap would dictate a rename of the field 1 with a decimal 1-number suffix. I may have several gaps in field 2 that would require numerous field 1 extensions.
Thanks for any assistance.