For eg
I have a huge file with the pattern below. The search pattern is the date and i have to prefix the date for the next n number of rows. The date pattern is at the exact nth repetitive line and the next few lines are also a fixed number.
date 1
line 1
line 2
line 3
date 2
line 4
line 5
line 6
date 3
line 7
line 8
line 9
The above pattern should be transformed to look like below
date 1 line 1
date 1 line 2
date 1 line 3
date 2 line 4
date 2 line 5
date 2 line 6
date 3 line 7
date 3 line 8
date 3 line 9
Is there a simple command using sed/awk which would do this or should i go ahead and write a bash/python script ?