Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: nat() in pure shell



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