Через мой любимый Python ...
with open('/path/to/the/file') as f:
counter = False
for line in f:
if line.startswith('*') and not counter:
m = line.strip().lstrip('*')
counter = True
elif line.startswith('*') and counter:
counter = False
elif counter:
if not line.startswith('*'):
print(line.strip() + m)
else:
print(line.strip())