This find command matches the files I'm searching for:
find / -type f -regextype sed -regex ".*/g\.[0-9]\{4\}.*"
How do I move to the next step of listing just the unique directory names that contain those files? (I don't need to display all the files.)
将输出传递给删除文件名的sed
命令,然后使用uniq
删除重复项:
find / -type f -regextype sed -regex ".*/g\.[0-9]\{4\}.*" | sed 's|/[^/]*$||' | uniq
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.