I have the following problem: I have a list of files like this
File256name.txt
File307list.cvs
File2014text.xls
I would use the command "find" to only find files with number in the name lower than 1950 so as the previous list I would only have these files listed
File256name.txt
File307list.cvs
I tried this command
find . -type f \( -iname '*[1-9][0-9][0-9]*' \)
but it will display also files containing number in the name >1950
As additional indication all files can have different filenames and extensions and the position of the number is unpredictable...I'm looking for a simple command to use with find (for me is mandatory to use find) by including a formula to select only files that contains numbers lower than 1950
Also consider the limitation of my linux version that is BusyBox v1.16.1
Thanks for your help
You'll need to use a regex that will differenciate the decade in respect to century:
(This will find 4-digit numbers greater than or equal 1950).
Using this regex you may use the negate option of
find
to get files with no number >= 1950. To eliminate files without any number, use a second criteria.I've not tested this with find, but the regex you use allows for 1000 < 1950.
Edit:
The full command:
With busybox's find some more escaping is necessary: