Ok, so it would be good if you showed us what you tried, and maybe other resources that you’ve looked at. Really happy to help but I don’t want to just write the solution for you
Have you thought about how to achieve these two points with JavaScript? What functions have you considered?
As others have pointed out there isn’t much information to go on most important (I think) is “what are you trying to do”? It might turn out that you have to use this file, it may turn out that any other format would work better. What does it do when there are no more lines in the file?