From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: zsh-users-return-23703-ml=inbox.vuxu.org@zsh.org X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 86f4491f for ; Wed, 3 Oct 2018 23:23:43 +0000 (UTC) Received: (qmail 21036 invoked by alias); 3 Oct 2018 23:23:26 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 23703 Received: (qmail 5745 invoked by uid 1010); 3 Oct 2018 23:23:26 -0000 X-Qmail-Scanner-Diagnostics: from aurora-borealis.phear.org by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(94.242.205.164):SA:0(-1.9/5.0):. Processed in 2.516446 secs); 03 Oct 2018 23:23:26 -0000 X-Envelope-From: eiro@phear.org X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | X-Virus-Scanned: amavisd-new at phear.org DKIM-Filter: OpenDKIM Filter v2.10.3 aurora-borealis.phear.org 746FF10699 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=phear.org; s=20180217; t=1538608997; bh=89plFzZOAiHvqj3TuGwoWWcZM7VFnLxQkF8tmthwi0E=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LIBNJjm6YoPrOq8H1ck/gep/Y2ffDFsz0zo12Pm8/Tfyma6lnJ7sI6TC83OGgxHKq netJsObvQebrAltqK0XVArhOxl3Fd1VCYA08bGNp8EAiuKA2X1WJcQbg1h+7GXUTMv KsUSbzZ0ckT3abRMgO3Hc71tp3S13kNZ7Rgllk/dg3duGVOMWQOBkGHGc27XjdGTvE YvBbwlk0Vj7ieAOKVAIk3jhfoROpb1FjQ4VH4qbCQu6hnjmq1dLLCq0wOEfeQIX637 0L4AAhTXFS6oRIw6/7eSqtDqCXw4d8VD6h1oq5qT0+Ah6flZgffipefxsCg4o2chYQ zIYYDQqBlXedA== Date: Thu, 4 Oct 2018 01:23:15 +0200 From: Marc Chantreux To: Daniel Shahaf Cc: zsh-users@zsh.org Subject: Re: nat() in pure shell Message-ID: <20181003232315.GA2313@prometheus.u-strasbg.fr> References: <20181003143800.GA9162@prometheus.u-strasbg.fr> <20181003162552.GA14697@prometheus.u-strasbg.fr> <1538588839.1108014.1529541968.7F45A0E3@webmail.messagingengine.com> <20181003204759.GA27384@prometheus.u-strasbg.fr> <1538604514.1187647.1529855840.350C7D63@webmail.messagingengine.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1538604514.1187647.1529855840.350C7D63@webmail.messagingengine.com> User-Agent: Mutt/1.10.1 (2018-07-13) On Wed, Oct 03, 2018 at 10:08:34PM +0000, Daniel Shahaf wrote: > > yes '' | nl -ba > > > > is a lot of extra caracters > > > > 00000000: 2020 2020 2031 090a 2020 2020 2032 090a 1.. 2.. > > Then pipe it to 'xargs -n1' or tr(1) or sed(1) or ... yes .. but if i really want to avoid the shell version, i'll go to awk: awk -vi=${1-0} 'BEGIN { while (1) print i++ }' |sed 5q > While at it, 'pr -tn' is another line-numbering command. so is awk :) print -l {a..c} | awk -vi=${1-0} '{print i++,$0}' regards marc