Set -A myarray $(< file)

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of R. Bernstein
Sent: Tuesday, September 23, 2008 3:22 PM
To: [email protected]
Subject: [ast-users] Fast way to read a file into an array variable? 

I'd like to a read potentially large files (a zsh script file) into an
array fast. It is not uncommon for a GNU autoconf configure script to
be tens of thousands of lines long.  (As an example, The zsh configure
script is over 20,000 lines long).

I know about redirecting input in a loop and/or alternatively using
"read" in a loop. But for a large file this tends to be slow. As a
result, both bash and zsh have a mechanism for doing this faster than
using a read loop. For zsh the speed difference was 0.189 seconds (to
load zsh and the module and read) versus over a minute. For bash the
difference in speeds is, I believe, even greater.

So what's the fastest way to large read a file into an array? 

Thanks.
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users

THE INFORMATION CONTAINED IN THIS MESSAGE AND ANY ATTACHMENT MAY BE PRIVILEGED, 
CONFIDENTIAL, PROPRIETARY OR OTHERWISE PROTECTED FROM DISCLOSURE. If the reader 
of this message is not the intended recipient, you are hereby notified that any 
dissemination, distribution, copying or use of this message and any attachment 
is strictly prohibited. If you have received this message in error, please 
notify us immediately by replying to the message and permanently delete it from 
your computer and destroy any printout thereof.
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users

Reply via email to