[Info-vax] Text processing on VMS
Craig A. Berry
craigberry at nospam.mac.com
Sun Oct 13 18:24:14 EDT 2024
On 10/13/24 2:26 PM, Arne Vajhøj wrote:
> But in a relevant script language then it should be a one statement
> problem (although in most cases splitting that one statement over
> multiple lines is a good thing for readability).
>
> import java.nio.file.*
>
> Files.lines(Paths.get("login.com"))
> .filter(line -> line.contains("java"))
> .map(line -> line[2..12])
> .forEach(System.out::println)
>
> output pos 2..12 (pos is 0 based!) from all lines of login.com
> that contains "java".
Opening an editor, typing all that in, running the java compiler, and
then running the compiled program all seems like a lot of work to me
when all you need to do is:
$ perl -nE "say substr($_, 2, 12) if $_ =~ m/java/i;" < login.com
More information about the Info-vax
mailing list