Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Change on stdout
- X-seq: zsh-users 14271
- From: Omari Norman <omari@xxxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: Change on stdout
- Date: Fri, 31 Jul 2009 15:40:13 -0400
- In-reply-to: <20090731175207.46af5c20.tartifola@xxxxxxxxx>
- Mail-followup-to: zsh-users@xxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20090731175207.46af5c20.tartifola@xxxxxxxxx>
On Fri, Jul 31, 2009 at 05:52:07PM +0200, tartifola@xxxxxxxxx wrote:
> I need to operate a transformation on the standard output
> of a command. The output is a list of numbers
>
> 1 5 8 ...
>
> and I like to have it transformed in
>
> a1=1,a2=5,a3=8,...
This is inelegant (like my knowledge of the shell) but should work.
$ nums=$(your_command)
$ numArray=( ${=nums} )
$ for (( n = 1; n <= ${#numArray}; n++))
echo -n "a${n}=${numArray[$n]},"
done
echo
--
A smart man knows everything. A wise man knows everybody.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author