I have a cricket commentary like -
0.3 Richardson to RG Sharma, 2 runs, gentle, non-swinging length ball on off, Rohit seeks to pick it up. Hit high on the bat and spooned over the returning Mitch Marsh at midwicket 0.4 Richardson to RG Sharma, 1 run, banged in short, controlled pull to long leg
What I want to do is join the
n.n lines with the following lines, replacing newlines with spaces. Then, I want to delete everything from the second comma to the end on each line, so the output from the input above should be:
0.3 Richardson to RG Sharma, 2 runs 0.4 Richardson to RG Sharma, 1 run
-- Edit -- I used [0-9]"\n"[A-Z] to match the newline but I have trouble reproducing the exact number and character that was matched. Also for deleting everything after 2 commas, I tried parameter expansion but I could only get it to work for deleting after a single comma.