Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: nat() in pure shell
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author