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

Re: Change on stdout



On Fri, Jul 31, 2009 at 11:52 AM, <tartifola@xxxxxxxxx> wrote:
>
>
> 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?

Use a tool like sed - this should work with any verion of sed ever
made, I believe:

echo "1 2 3 4 5" | sed -e 's/[0-9][0-9]*/a&=&/g' -e 's/ /,/g'

Of course, this has nothing whatsoever to do with zsh, but I can't
think of any interpretation of your question that would...

~Matt



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