Dear all
I have a text file which contains plenty of lines.In this file every two line is a group that should stay with each other.A part of my file is shown here:

# 11 25 0
MRD 80.0343 1 P

# 12 16 0
MRD 70.9987 1 P
# 18 25 0
MRD 79.6232 1 P

# 13 3 0
MRD 92.2977 1 P
# 16 12 0
MRD 80.4427 1 P
# 10 13 0
SHB 68.6062 1 P
# 11 25 0
SHB 25.7899 1 P

# 10 24 0
SHB 52.7862 1 P
# 18 25 0
SHB 70.7264 1 P

# 11 25 0
TBZ 62.0731 1 P

# 13 11 0
TBZ 9.8269 1 P
# 18 25 0
TBZ 62.6325 1 P


I want to merge every group with the same first line. In other words to keep the first line and add the second line of the matched griups respectively like this:
# 11 25 0
MRD 80.0343 1 P
SHB 25.7899 1 P
TBZ 62.0731 1 P
# 18 25 0
MRD 79.6232 1 P
SHB 70.7264 1 P
TBZ 62.6325 1 P
# 12 16 0
MRD 70.9987 1 P
# 13 3 0
MRD 92.2977 1 P
# 16 12 0
MRD 80.4427 1 P
# 10 13 0
SHB 68.6062 1 P
# 10 24 0
SHB 52.7862 1 P
# 13 11 0
TBZ 9.8269 1 P

As you can see every two line as a group should be compared according to their first line and if thats the same the second line of the groups are written under the key line.And if no matches occur we keep also that group in output file.
I would appreciate any Help
Thanks