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

On Tue, 23 Sep 2008 16:22:27 -0400 R. Bernstein wrote:
> Lagerman, Thomas writes:
>  > Set -A myarray $(< file)

> This (with a lowercase "set") seems to put each *word* in myarray, and
> what I want is access by line. 

> It is interesting, although I am at a loss to explain how it works. -A
> is for associative array, right? 

> Also given that it works on words, it doesn't match what wc seems to report:

> $ set -A myarray $(< ./ksh-93t-20080919/src/cmd/ksh93/RELEASE93)
> $ echo [EMAIL PROTECTED]
> 3707
> $  wc ./ksh-93t-20080919/src/cmd/ksh93/RELEASE93
> 455  3705 22303 ./ksh-93t-20080919/src/cmd/ksh93/RELEASE93

> Also there is the interesting issue of what happens if the file
> doesn't have a trailing newline or not. It would be nice to detect
> that, but make sure the text is part of the array.

> But thanks for the info. It is interesting to learn of these things
> that seem to be lurking in shell languages.

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

Reply via email to