GNU bug report logs - #20767
seq: support multiple % in -f format

Previous Next

Package: coreutils;

Reported by: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>

Date: Mon, 8 Jun 2015 02:07:02 UTC

Severity: wishlist

To reply to this bug, email your comments to 20767 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#20767; Package coreutils. (Mon, 08 Jun 2015 02:07:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Mon, 08 Jun 2015 02:07:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
To: bug-coreutils <at> gnu.org
Subject: seq invocation limitations documentation
Date: Mon, 08 Jun 2015 07:28:25 +0800
On (info "(coreutils) seq invocation") perhaps mention if one needs to
use two % items, a for loop might be required,

$ for i in `seq 14484 10000 34484`; do printf %d=0x%x\\n $i $i; done
14484=0x3894
24484=0x5fa4
34484=0x86b4




Information forwarded to bug-coreutils <at> gnu.org:
bug#20767; Package coreutils. (Mon, 08 Jun 2015 09:10:03 GMT) Full text and rfc822 format available.

Message #8 received at 20767 <at> debbugs.gnu.org (full text, mbox):

From: Stephane Chazelas <stephane.chazelas <at> gmail.com>
To: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Cc: 20767 <at> debbugs.gnu.org
Subject: Re: bug#20767: seq invocation limitations documentation
Date: Mon, 8 Jun 2015 10:09:33 +0100
2015-06-08 07:28:25 +0800, 積丹尼 Dan Jacobson:
> On (info "(coreutils) seq invocation") perhaps mention if one needs to
> use two % items, a for loop might be required,
> 
> $ for i in `seq 14484 10000 34484`; do printf %d=0x%x\\n $i $i; done
> 14484=0x3894
> 24484=0x5fa4
> 34484=0x86b4
[...]

Running several commands in sequence in a loop like that (and
storing the whole output of seq in memory) is not so good an
idea. At this point, it's probably better to use awk:

awk 'BEGIN{for (i = 14484; i <= 34484; i += 10000)
  printf "%d=0x%x\n", i, i}'

See also
https://unix.stackexchange.com/questions/169716/why-is-using-a-shell-loop-to-process-text-considered-bad-practice

Might be worth pointing out awk as a standard alternative to seq
for portability btw.

-- 
Stephane




Information forwarded to bug-coreutils <at> gnu.org:
bug#20767; Package coreutils. (Mon, 08 Jun 2015 15:10:03 GMT) Full text and rfc822 format available.

Message #11 received at 20767 <at> debbugs.gnu.org (full text, mbox):

From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
To: Stephane Chazelas <stephane.chazelas <at> gmail.com>
Cc: 20767 <at> debbugs.gnu.org
Subject: Re: bug#20767: seq invocation limitations documentation
Date: Mon, 08 Jun 2015 23:08:53 +0800
Actually it would be great if one could just do
seq -f %d=0x%x 14484 10000 34484
where seq could just take the standard printf arguments, and % could be
used more than once, as I don't think it could mean any second argument...




Severity set to 'wishlist' from 'normal' Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 23 Oct 2018 02:27:01 GMT) Full text and rfc822 format available.

Changed bug title to 'seq: support multiple % in -f format' from 'seq invocation limitations documentation' Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 23 Oct 2018 02:27:01 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 237 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.