What about replace comment with method, e.g.:

```groovy
def parseFilenameFromCommandLine(cmd) {
    (cmd =~ /-o ([a-zA-Z0-9\/\.:-]+)/)[0][1]
}

...

def filename = parseFilenameFromCommandLine(it)
```