Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: generate series of strings



On Fri, 9 Jul 2010 15:36:00 +0200
Guillaume Brunerie <guillaume.brunerie@xxxxxxxxx> wrote:

> 2010/7/9 <tartifola@xxxxxxxxx>
> 
> >
> >
> > Hi,
> > is there a way to obtain from the command line a series of strings like
> >
> > (1:3) (4:6) (7:9)...
> >
> > always with the same increment. I'm playing with 'seq' and 'sed' but
> > perhaps it's not the best approach.
> > Thanks,
> > A.
> >
> 
> Hi,
> You can use a for-loop :
> 
> for (( i = 0; i < 5; i++ ))
> do
>     echo -n "($(( 3 * i + 1 )):$(( 3 * i + 3))) "
> done

Thanks for your help, it works perfectly. Just a curiosity, any possible solution without a
loop for? 



Messages sorted by: Reverse Date, Date, Thread, Author