The Groovy command line (groovy or groovy.bat) is the easiest way to start using the Groovy Language.
If you have a groovy script, you can edit and run the script immediately.
However you can also run such a simple groovy program by providing the script in the command line arguments.
This may not look useful, but it fits in with the UNIX tradition of chaining simple programs together to build powerful commands. Tools like perl, sed, awk and grep do these jobs very well. But many users have limited experience with these tools' arcane syntax and will be more familiar with Java and therefore Groovy.
Because looping through STDIN or input files tends to be a common thing to do, groovy (and ruby, perl etc) provide shortcuts for this. currently broken, groovy not defaulting to STDIN
-n will loop through each line of the input, and provide it to your script in the line variable.
If we definately want to print the output of each line we can use -p and shorten it to
For more examples or inspiration browse through the search results for Perl One Liners