Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: nat() in pure shell
- X-seq: zsh-users 23702
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: Marc Chantreux <eiro@xxxxxxxxx>
- Subject: Re: nat() in pure shell
- Date: Wed, 03 Oct 2018 22:08:34 +0000
- Cc: zsh-users@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=message-id:from:to:cc:mime-version :content-transfer-encoding:content-type:references:subject:date :in-reply-to; s=fm1; bh=NiD9OAtozIF0P29VCLFHw731SrKI3Le3vuQE4bFe /r4=; b=hgtwAferXjR1p78OmFn5zjEj8nAebvw1ZTHS+bgxfOx154SryfWB7XPf IYr5DRQMGrgW16l98vuDABpWatqomrX6q3sRq4NZWtw4/34W18yvroatpI/cH6w0 vwy8aRz/biBir0zC7zhl7HIWmSLDGXvLYnqYrSNlFMt9SbMWS4UK5XDB9EJUZXAU sIkXFwzc/vKH4AiPhnDc22Xe/mQCVVH9sse2jHtR+Cp0z2tIpWI+fsDWfAYSS3sH Jf7MWmtoMDK/jdqKqmqzNp7AXj3HFqt+C7Vel0R+W98+IXKh0rAWbX5mBaNjs2Rx c79JpysY01zPixBI+IDAiDGUdeKyaw==
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=NiD9OAtozIF0P29VCLFHw731SrKI3Le3vuQE4bFe/ r4=; b=JAq4kbC9eKkhkXpXPS69V96WghoBKwet5DxEtE66hUnF8UA9rs5VnWDCj XdzTbTtzMlIbh2IniB7VpwkGnJwEEhue25D41lWWXdEzYLx6Nvq7QPx6fpMyiKyb 0Sr9YLScT85dNQ+Qs/BGe7TCt74+uUHwMIf4mu7SYue/w7+tp7JcLgSKlHv6o0PU ogrJPIRjjRDDZxucjmTkANU1F1grWniTh9LdvwDjVbtenSLKC4gZRmOoeJoM7QM/ PziDAdSIMjvYpnT+vCk6cmPFysLnOBoWFXe9BNGQXBRp4Ho7v6IMRAgv4Tp9v36B CHfxVviPyNNL7qceAFRxpiBXJSb0A==
- In-reply-to: <20181003204759.GA27384@prometheus.u-strasbg.fr>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <20181003143800.GA9162@prometheus.u-strasbg.fr> <CAH+w=7ZuFKDMBvL7XdSqYXcXy5hrc_zQPK0KsLrTZ1Szrfu6Ow@mail.gmail.com> <20181003162552.GA14697@prometheus.u-strasbg.fr> <1538588839.1108014.1529541968.7F45A0E3@webmail.messagingengine.com> <20181003204759.GA27384@prometheus.u-strasbg.fr>
Marc Chantreux wrote on Wed, 03 Oct 2018 22:47 +0200:
> On Wed, Oct 03, 2018 at 05:47:19PM +0000, Daniel Shahaf wrote:
> > Marc Chantreux wrote on Wed, 03 Oct 2018 18:25 +0200:
> > > nat () {
> > > local -i x=${1-0}
> > > while print $[x++]
> > > }
> >
> > Compare:
> > yes '' | nl -ba
>
> wow ... good to know nl exists (i missed -nrz all the time). however
>
> 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 ...
While at it, 'pr -tn' is another line-numbering command.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author