Deutsch   English   Français   Italiano  
<vehhae$rkn7$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!news.roellig-ltd.de!open-news-network.org!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: "Craig A. Berry" <craigberry@nospam.mac.com>
Newsgroups: comp.os.vms
Subject: Re: Text processing on VMS
Date: Sun, 13 Oct 2024 17:24:14 -0500
Organization: A noiseless patient Spider
Lines: 23
Message-ID: <vehhae$rkn7$1@dont-email.me>
References: <8734l0t56u.fsf@lucy.meyer21c.net> <veh45h$pplr$1@dont-email.me>
 <veh575$q0bo$1@dont-email.me> <veh6s8$pplq$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 14 Oct 2024 00:24:14 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="4aa3446436764ab89d6144bbc9337c95";
	logging-data="905959"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/b2j1I93q9Bx0VT8xDxv6v3FGEZYxGOd8="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:UyWwX4Kng6mWZ1M4rWsGiLOj4Nw=
Content-Language: en-US
In-Reply-To: <veh6s8$pplq$1@dont-email.me>
Bytes: 1940


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