From: Marc Chantreux <eiro@phear.org>
To: Daniel Shahaf <d.s@daniel.shahaf.name>
Cc: zsh-users@zsh.org
Subject: Re: nat() in pure shell
Date: Thu, 4 Oct 2018 01:23:15 +0200 [thread overview]
Message-ID: <20181003232315.GA2313@prometheus.u-strasbg.fr> (raw)
In-Reply-To: <1538604514.1187647.1529855840.350C7D63@webmail.messagingengine.com>
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
next prev parent reply other threads:[~2018-10-03 23:23 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-03 14:38 dangerous behavior of while in zsh 5.6 ? Marc Chantreux
2018-10-03 15:28 ` Bart Schaefer
2018-10-03 16:25 ` Marc Chantreux
2018-10-03 17:47 ` Daniel Shahaf
2018-10-03 20:47 ` nat() in pure shell Marc Chantreux
2018-10-03 22:08 ` Daniel Shahaf
2018-10-03 23:23 ` Marc Chantreux [this message]
2018-10-08 10:38 ` Vincent Lefevre
2018-10-04 15:50 ` Bart Schaefer
2018-10-03 20:54 ` dangerous behavior of while in zsh 5.6 ? Bart Schaefer
2018-10-03 21:06 ` Marc Chantreux
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181003232315.GA2313@prometheus.u-strasbg.fr \
--to=eiro@phear.org \
--cc=d.s@daniel.shahaf.name \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).