Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linux file names & file globbing

I have a list of files named:

file000
file001
file002
file003
...
file1100

How can I match all files that have a number greater than 800 but less than 1000 ? I am using linux bash

Thank you


Edit

Actually, my files are named like:
ab869.enc
cp936.enc
g122345.enc
x2022.enc
abc8859-14.enc
aax5601.enc
cp936-1.enc

so the first solution dont match the correct files :(

How can I match files that have number between 800-999 ?

like image 869
amprantino Avatar asked Jan 17 '23 23:01

amprantino


1 Answers

In shell, try this:

ls file{801..999}

This will list the files starting with file801 and ending with file999.

For explanation, see the manual:

  • http://www.gnu.org/software/bash/manual/bashref.html#Brace-Expansion
like image 192
icyrock.com Avatar answered Jan 22 '23 19:01

icyrock.com