in reply to group and print data seperately

See find min, max and average.

Also, maybe you want to tell us what problems you have now since you told us in Re^2: find min, max and average that you had solved your problem?

Please note that this is not a script writing service. We expect you to do most of the work. We will help you learn by answering your concrete questions and providing hints on what to study. But writing your programs is something that you must do yourself.