Glenn Fowler wrote:
try
        IFS=$'\n' set -A myarray $(< ./ksh-93t-20080919/src/cmd/ksh93/RELEASE93)
if it works post a timing comparison

It works - and much better than the read loop.

$ uname -a
UWIN-XP henk-xp 4.2/5.1 2600 i686 i686 i386 UWIN-XP
$ time IFS=$'\n' set -A a $(< $file )

real    0m0.11s
user    0m0.11s
sys     0m0.00s

$ echo ${#a[*]}
67809


$ unset a
$ set -A a
$ i=1 && time while read a[i]; do ((i+=1)); done <$file

real    1m7.26s
user    0m15.01s
sys     0m49.23s

$ print $i
67810
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users

Reply via email to