A warm welcome to the Ranch
Yes, it is possible to read text files in Groovy. The documentation you started with shows how to do that (I found where). But before you dive into the syntax, maybe it is worth to start with pseudo code.
Please try to define in simple steps in english or other your favorite language, what needs to be done, so everyone (especially you) could understand it (even 10 years old child). Once you're clear about the things you are needed to do, we'll look up for syntax details, so we can achieve that.
Programming first is a planning and defining clearly the steps what needs to be done. In similar way as a recipe of your favorite food. If you'd start doing things you're not sure about, probably you'd get something wrong.
In case you still wondering, how the heck files are being read in groovy:
Documentation wrote:
For more extensive and flexible ways to read the files, please go through this
tutorial (<- link), so there you'll find examples where to start. Look for paragraph "
3.3.1. Working with IO".