Here is an example of my txt file
John NY 2019 APR Mark SC 2019 JAN Ava CA 2018 AUG
Here is the example of the target txt file
Name,Location,Year,Month John, NY,2019,APR Mark, SC,2019,JAN Ava, CA,2018,AUG
The number of fields wont change. Basically how am I able to write a script that can identify that every 4th line is the month and the line after that is the name?