2018年4月18日 星期三

[Linux 常見問題] How to use regex with find command?

Source From Here 
Question 
I have some images named with generated uuid1 string. For example 81397018-b84a-11e0-9d2a-001b77dc0bed.jpg. I want to find out all these images using "find" command: 
# find . -regex "[a-f0-9\-]\{36\}\.jpg".

But it doesn't work. Something wrong with the regex? Could someone help me with this? 

How-To 
Try below command: 
// -regextype type: Changes the regular expression syntax understood by -regex and -iregex tests which occur later on the command line.
// -regex pattern: File name matches regular expression pattern. This is a match on the whole path, not a search.

# find . -regextype sed -regex ".*/[a-f0-9\-]\{36\}\.jpg"

沒有留言:

張貼留言

[NodeJS 文章收集] NodeJS accessing file with relative path

Source From  Here Question It seemed like a straight forward problem. But I am not able to crack this. Within  helper1.js  I would like to a...