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

Re: "joining" an array with tabs (default is space)



On Tue, 9 Dec 2008 11:27:38 -0800
"Webb Sprague" <webb.sprague@xxxxxxxxx> wrote:
> If I set IFS='\t', it works great with read -A LINE.  However I want
> to join the output using '\t' instead of spaces-- is there a simple
> way to do that?  I can write a for loop, or maybe recycle print -f
> "\t%s", or maybe use columns in the print, but I was hoping for a
> super graceful (ie typical zsh) approach.

  ${(pj.\t.)array}

It's a bit cryptic, but the documentation is there under "Parameter
Expansion Flags" in the zshexpn manual.

-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



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