Regex : help - How to write a range in ls

Experts,
Quick question for you guys:

  • There are a lot of files.
  • How to list all files in one command from arch1_171034 to 63 , in the below examples.

That means how to list with ls :

arch1_171034_667780.dbf  to arch1_171063_667780.dbf 

files.

Thanks .

ls arch1_1710{34..63}_667780.dbf

That is not a regex exactly. It will feed every name between 34 and 63 into ls, which will complain about any files not actually found in that range. It may be sufficient for the purpose.

That is correct.

I forgot to mention that it is not regex but a bash sequence expression that takes the form {x..y} , where x and y are either integers or single characters.

A more portable pathname pattern matching approach:

arch1_17103[4-9]_667780.dbf arch1_1710[45][0-9]_667780.dbf arch1_17106[0-3]_667780.dbf

Regards,
Alister

Hi Yoda,
it did not work,

*arch1_1710{34..63}_667780.dbf not found

The shell is not bash , but it is hp-ux ksh , k shell.

Thanks.

Alright, then use Alister's solution which is portable and will work in HP-UX

Yes, Yoda, Thanks for the update.. Alister's one worked all right.

Worked perfectly with ls to get the desired output:

arch1_17103[4-9]_667780.dbf arch1_1710[45][0-9]_667780.dbf arch1_17106[0-3]_667780.dbf

Thanks everyone ...