Re: bash increment in a given way

2010-12-11 Thread Samuel Martín Moro
something like that?
for i in `seq 1 20 | awk 'BEGIN{n=0; max=4; avg=max/2}{if (n=avg) {print
$0;} n++; if (n=max) {n=0;} }'`
do
echo welcome $i times
done



On Sat, Dec 11, 2010 at 3:34 PM, S Mathias smathias1...@yahoo.com wrote:

 , that i can use this, when i want




-- 
Samuel Martín Moro
{EPITECH.} tek5
CamTrace S.A.S
  (+033) 1 41 38 37 60
  1 Allée de la Venelle
  92150 Suresnes
  FRANCE

Nobody wants to say how this works.
  Maybe nobody knows ...
  Xorg.conf(5)
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: bash increment in a given way

2010-12-11 Thread Samuel Martín Moro
with seq starting with 0, to fit your example...

On Sat, Dec 11, 2010 at 5:34 PM, Samuel Martín Moro faus...@gmail.comwrote:

 something like that?
 for i in `seq 1 20 | awk 'BEGIN{n=0; max=4; avg=max/2}{if (n=avg) {print
 $0;} n++; if (n=max) {n=0;} }'`
 do
 echo welcome $i times
 done



 On Sat, Dec 11, 2010 at 3:34 PM, S Mathias smathias1...@yahoo.com wrote:

 , that i can use this, when i want




 --
 Samuel Martín Moro
 {EPITECH.} tek5
 CamTrace S.A.S
   (+033) 1 41 38 37 60
   1 Allée de la Venelle
   92150 Suresnes
   FRANCE

 Nobody wants to say how this works.
   Maybe nobody knows ...
   Xorg.conf(5)




-- 
Samuel Martín Moro
{EPITECH.} tek5
CamTrace S.A.S
  (+033) 1 41 38 37 60
  1 Allée de la Venelle
  92150 Suresnes
  FRANCE

Nobody wants to say how this works.
  Maybe nobody knows ...
  Xorg.conf(5)
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: bash increment in a given way

2010-12-11 Thread Samuel Martín Moro
also... if (navg) ... sorry for the sp am...

On Sat, Dec 11, 2010 at 5:36 PM, Samuel Martín Moro faus...@gmail.comwrote:

 with seq starting with 0, to fit your example...

 On Sat, Dec 11, 2010 at 5:34 PM, Samuel Martín Moro faus...@gmail.comwrote:

 something like that?
 for i in `seq 1 20 | awk 'BEGIN{n=0; max=4; avg=max/2}{if (n=avg) {print
 $0;} n++; if (n=max) {n=0;} }'`
 do
 echo welcome $i times
 done



 On Sat, Dec 11, 2010 at 3:34 PM, S Mathias smathias1...@yahoo.comwrote:

 , that i can use this, when i want




 --
 Samuel Martín Moro
 {EPITECH.} tek5
 CamTrace S.A.S
   (+033) 1 41 38 37 60
   1 Allée de la Venelle
   92150 Suresnes
   FRANCE

 Nobody wants to say how this works.
   Maybe nobody knows ...
   Xorg.conf(5)




 --
 Samuel Martín Moro
 {EPITECH.} tek5
 CamTrace S.A.S
   (+033) 1 41 38 37 60
   1 Allée de la Venelle
   92150 Suresnes
   FRANCE

 Nobody wants to say how this works.
   Maybe nobody knows ...
   Xorg.conf(5)




-- 
Samuel Martín Moro
{EPITECH.} tek5
CamTrace S.A.S
  (+033) 1 41 38 37 60
  1 Allée de la Venelle
  92150 Suresnes
  FRANCE

Nobody wants to say how this works.
  Maybe nobody knows ...
  Xorg.conf(5)
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: bash increment in a given way

2010-12-11 Thread Charlie Kester

On Sat 11 Dec 2010 at 06:34:20 PST S Mathias wrote:

It's ok, that i can use this, when i want an incrementing sequence, in a given 
way:

# {START..END..INCREMENT}
$ for i in {0..10..2}; do echo Welcome $i times; done
Welcome 0 times
Welcome 2 times
Welcome 4 times
Welcome 6 times
Welcome 8 times
Welcome 10 times
$

but what's the magic for this? :

$ MAGIC; do echo Welcome $i times; done
Welcome 0 times
Welcome 1 times
Welcome 4 times
Welcome 5 times
Welcome 8 times
Welcome 9 times
$


man jot(1)
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: bash increment in a given way

2010-12-11 Thread Charlie Kester

On Sat 11 Dec 2010 at 09:57:08 PST Charlie Kester wrote:

On Sat 11 Dec 2010 at 06:34:20 PST S Mathias wrote:

It's ok, that i can use this, when i want an incrementing sequence, in a given 
way:

# {START..END..INCREMENT}
$ for i in {0..10..2}; do echo Welcome $i times; done
Welcome 0 times
Welcome 2 times
Welcome 4 times
Welcome 6 times
Welcome 8 times
Welcome 10 times
$

but what's the magic for this? :

$ MAGIC; do echo Welcome $i times; done
Welcome 0 times
Welcome 1 times
Welcome 4 times
Welcome 5 times
Welcome 8 times
Welcome 9 times
$


man jot(1)


Or maybe not.  
It's still morning here and the coffee hasn't kicked in yet.  

I usually reach for jot when constructing loops that look like yours, 
but on second glance I'm not sure it can produce the output you want.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org