find command with 'regex' match not working

后端 未结 1 702
梦毁少年i
梦毁少年i 2021-01-20 04:12

Am trying to do a simple file-name match with this below regex which I tested to be working from this page for a sample file-name ABC_YYYYMMDDHHMMSS.sha1

<
1条回答
  •  借酒劲吻你
    2021-01-20 04:38

    add .* at the start of your regex because you will always get something like ./ at start of path

    find . -type f -regextype posix-extended -regex '.*ABC_20[0-9]{2}(0[1-9]|1[0-2])([0-2][0-9]|3[0-1])([0-2][0-3])([0-5][0-9])([0-5][0-9])\.sha1'
    

    0 讨论(0)
提交回复
热议问题