Subject: bug#20767: seq invocation limitations documentation

From: Stephane Chazelas <[email-masked]>
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