[Info-vax] Text processing on VMS
Arne Vajhøj
arne at vajhoej.dk
Sun Oct 13 20:39:08 EDT 2024
On 10/13/2024 8:14 PM, Arne Vajhøj wrote:
> It is not Java but Groovy, so compile is optional.
The difference is all in the wrapping though.
$ type P.java
import java.nio.file.Files;
import java.nio.file.Paths;
public class P {
public static void main(String[] args) throws Exception {
Files.lines(Paths.get("login.com"))
.filter(line -> line.contains("java"))
.map(line -> line.substring(2, 13))
.forEach(System.out::println);
}
}
$ type s.groovy
import java.nio.file.*
Files.lines(Paths.get("login.com"))
.filter(line -> line.contains("java"))
.map(line -> line[2..12])
.forEach(System.out::println)
$ javac P.java
$ java P
...
$ groovy s.groovy
...
(I don't even have groovysh defined on VMS, so no easy way to try -e)
Arne
More information about the Info-vax
mailing list