in reply to •Re^6: Sort Large Files
in thread Sort Large Files

However, the second part does work on real shells, just not on bash or csh.
I presume you mean with "real shells", your current favourite shell, "zsh". You are only partially right. You are right that the syntax works, but not the semantics. In
file="data1 data2" <$file wc -l
zsh does not give you the number of lines in the files "data1" and "data2". Instead, it gives you the number of lines of the file (singular) "data1 data2". The use of cat isn't going to save the day though,
file="data1 data2" cat $file | wc -l
also gives a count of the number of lines in the file "data1 data2".

No doubt zsh has a way of getting the count of lines from both files, after all, zsh is supposed to have every feature under the sun and then some, but it's not <$file.

Replies are listed 'Best First'.
Re^8: Sort Large Files
by csh (Novice) on Jan 14, 2005 at 21:49 UTC

    What shell were you using that didn't give you a count of the lines in both data1 and data2?

    I tested the last snippet under Linux-x86 (Slackware 10), and NetBSD-sparc 1.6.2, and using bash and ksh93. In both cases I got a count of the lines in both files data1 and data2.

    Those of you seeing a count of the file "data1 data2" instead need to document what shells and systems you are seeing this on.