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

Re: generate series of strings



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


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