Hellow i have a large number of files that i want to concatenate to one. these files start with the word 'VOICE_' for example
VOICE_0000000000
VOICE_1223o23u0
VOICE_934934927349
@Scrutinizer and ctsngb
When the O/P comes back with the O/S I predict that it will be AIX or something which cannot deal with long command lines after expansion of "*" in Shell.
Solaris also has limitation to wildcard expansion :
$ uname -a
SunOS <anonymized> 5.9 Generic_122300-54 sun4u sparc SUNW,Sun-Fire-15000
$ ls | wc -l
68616
$ ls -l *
bash: /usr/bin/ls: Arg list too long
$
@ctsgnb & off topic
It would not be beyond the Shell compilers to flag "" in certain constructs as a Syntax Error. If I had my way an "" would be a Syntax Error in a "for" command. Just my personal view about open-ended lists. Others may differ.
Ok i got it : this is a limitation of the ls command (not the shell expansion)
correct ?
ls command should be coded to be able to handle huge number of argument. But I suppose it is choice of design, for performance reason.
Do you have any clue ?
$ print *
bash: print: command not found
$ sh print *
bash: /usr/bin/sh: Arg list too long
$
It's an operating system limitation. They can't. Ergo, you should program in ways that don't cram potentially unlimited numbers of arguments into a commandline. In some shells, you can get away with cramming billions of arguments into a builtin (and ONLY a builtin), but you really can't depend on that.
Bad: cat * > output
Good: ls | xargs cat > output xargs understands maximum arguments and can split them intelligently across several cat calls.
The same goes for things like for LINE in `cat foo` ; do ... ; done when foo exceeds 4K in size you may discover the maximum size of a shell variable on your system. Instead: while read LINE ; do ... ; done < foo
Essentially the idea's the same in all cases: Never force the shell to hold an entire anything in memory. (That actually applies to most programming languages, but shell makes it deceivingly easy to do so...) You'll hit walls at inconvenient times and it's never efficient. Process in bits.