Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Change on stdout
- X-seq: zsh-users 14273
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: Change on stdout
- Date: Fri, 31 Jul 2009 21:53:35 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=ST8oj5ByTAcGT2midiN7t1OWDAKYVpGbHkvSwsJhLt0=; b=DYuH2oZB8uS8G0svHwkjeCj+hnrbed4GqH8fVpud3TrgekjP1GBhYULiqiuJs4dIRG Rg1CoQwQLzRT6vThU6oUTnosSL2pXvk6Cv6+TXDzoBpjVLeMl4gSaKXetLt4VvJN77lk 6KjOuSaMFQinkhSAXn1vBN0BxIRPNEukfsnjo=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=XI6OeqAY8ikZOQTugku/2OKUEGlokC2pQqepF977G2/y7/76OGTxT/YlOCxeC3vL9y eIZbd29l7ZLy8VVr9iJK//y685c2x1R9fckDxt3DDeP6HEcksTdM+LpV1Pmb40PGZt1J OPvewwAqsjYeaEzszRbXs/zatn+rGKcxXsJXg=
- In-reply-to: <20090731175207.46af5c20.tartifola@xxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20090731175207.46af5c20.tartifola@xxxxxxxxx>
2009/7/31 <tartifola@xxxxxxxxx>:
> Hi,
> 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,...
>
> Any suggestion?
If they are one number per line:
% src/fibonacci | head -n25 | { \
integer i=1; while read num;do echo -n a$(( i++ ))=$num,; done }
a1=0,a2=1,a3=1,a4=2,a5=3,a6=5,a7=8,a8=13,a9=21,a10=34,a11=55,a12=89,a13=144,a14=233,a15=377,a16=610,a17=987,a18=1597,a19=2584,a20=4181,a21=6765,a22=10946,a23=17711,a24=28657,a25=46368,
If all numbers are one line, add -d" " to the read command.
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author