【问题标题】:find doesn't give me output when trying to find certain files尝试查找某些文件时 find 不给我输出
【发布时间】:2019-07-15 08:40:56
【问题描述】:

我想找到这些文件:

  • 智能用户04.csv
  • 智能用户07.csv

当我输入这个时:

find . -type f -regex "\bsmart\susers\d{2}\.csv\b"

一无所有

【问题讨论】:

标签: linux bash find


【解决方案1】:

见 cmets 提问;)

find . -type f -regextype posix-extended -regex '.*\bsmart\s+users[0-9]{2}\.csv\b'

【讨论】:

  • find . -type f -regextype posix-extended -regex ".*\bsmart users[0-9]{2}\.csv\b" | cut -c 3- 这会给我从没有./ 的智能开始的结果@
  • @SamNano 或者,不要调用第二个工具,只需执行 find . -type f -regextype posix-extended -regex ".*\bsmart users[0-9]{2}\.csv\b" -printf "%f\n" =)
【解决方案2】:

试试这个:

find . -type f -regex ".*smart users..\.csv"

或:

find . -type f -regextype egrep -regex ".*smart.users[[:digit:]]{2}.csv"

甚至:

find . -type f -regextype egrep -regex ".*smart users[[:digit:]]{2}.csv".

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多