I want to concatenate a bunch of files together in filename order.
Is it safe to assume that this will give me them in alphanumeric order?
cat *
i.e. the same order that ls gives.
|
feedback
|
|
Short answer: Yes it will. From the bash man page:
| |||||||||
feedback
|
|
The short answer is yes, but you need to be aware of what it thinks the alphanumeric order should be, as it may not correspond to the natural order you have in mind. For example, run some test on how upper and lower case are handled to find out on your system, as well as sequences of numbers. A common problem I have run into in ordering lists of files returned by a glob is numbered files. I am often given files numbered like:
However, a glob using the
So - to avoid this problem you'll either need to do some manipulation on the returned list of files, or rename files so that single digits have leading zero (i.e. | |||
|
feedback
|