Bash and sort files in order

Posted by Werner on Stack Overflow See other posts from Stack Overflow or by Werner
Published on 2009-11-17T06:53:41Z Indexed on 2010/04/30 11:07 UTC
Read the original article Hit count: 313

Filed under:
|

Hi,

with a previous bash script I created a list of files:

data_1_box
data_2_box
...
data_10_box
...
data_99_box

the thing is that now I need to concatenate them, so I tried

ls -l data_*

but I get

.....
data_89_box
data_8_box
data_90_box
...
data_99_box
data_9_box

but I need to get in the sucession 1, 2, 3, 4, .. 9, ..., 89, 90, 91, ..., 99

Can it be done in bash?

© Stack Overflow or respective owner

Related posts about bash

Related posts about sorting