Hello all,

I have a file similar to this, (about 1G)

==================================================
startpoint: AAA
endpoint: BBB
# body for every start/end combo
a/Xxxxxx yyy num1 num2 num3 & num4
.
.
.
a/ttttttt fff num4 num5 num6 * num722
b/ttttttt fff num44 num50 non_zero * num734
.
.
.
b/yyyyyy fff num43 num52 num65 num745
datapoint number1

datapoint -number1


startpoint: CCC
endpoint: DDD

zzzzzz yyy numa numb numc & num4
.
.
.
a4/nnnnn yyy num4 num5 num6 * num44
bb/nnnnn yyy num4 num5 num6 * num9
bb/kkkkk yyy num4 num5 non_zero * num8

.
.
.
datapoint number100

datapoint -number100
================================================== =================
For every startpoint/endpoint combo, I need to go into the body and find the line with "*". (As I have pointed out, not all lines will have a "*" in their 6th column. ) Also there will be multiple lines inside the body with "*" in column 6, but I need to pick the last one of them. This last line holds a non zero number in column 5. The rest of the lines with "char1" in column 6 will have zeros in their respective column 5s.

Finally print the startpoint/endpoint combo along with its "non_zero" column 5 value and column 7. Here is another complication for me – I also need to print the (n-1)th line's column 1 before the last "*" for every start/end combo. For instance, if you look at the 2nd start/end combo in the above example, I want print "bb/nnnnn" .

Also I want to print the "datapoint" number. This occurs twice in each section one and I want to ignore the negative value of this number which occurs the second time. i.e. from the above ex, only print number100 and not -number100.

O/P file,

Startpoint endpoint column5 column7 datapoint_number column1(of previous line)
CCC DDD non_zero num8 number100 bb/nnnnn


I'm a complete newbie to perl – any help will be appreciated !

Thanks a lot,
John