Question
I am trying to locate all files on a linux server that fit this profile:
sfvhebviweuiber9.html
sfvhebviweuiber11.html
jdjhwn2jjsfy2q10.html
Where the first 10-15
characters are a-z
, followed by [1-15]
, then .html
.
How can I use locate
(or any other method) to find all files that fit this profile?
The differences are basically the first 10-15
characters as they are made up of random alphabet characters.
Solution
I don't quite get the "[1-15]" part of your description, but I think this would do. You can refine the .*
part in the regex
locate -r '[a-z]\{10,15\}.*html'
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow