sharkdp / fd

A simple, fast and user-friendly alternative to 'find'
Apache License 2.0
34.3k stars 816 forks source link

[BUG] Can't Match /etc/passwd #1556

Closed ossie-git closed 6 months ago

ossie-git commented 6 months ago

Checks

Describe the bug you encountered:

I'm currently trying to match the following file:

ubuntu2204:/run/timeshift# ls -l backup/etc/passwd
-rw-r--r-- 1 root root 1829 Nov 30  2022 backup/etc/passwd

but can't. I've tried the following different patterns but none of them match:

# fd etc/passwd
# fd 'etc/passwd'
# fd 'etc\/passwd'
# fd '.*etc/passwd'
# fd -F "etc/passwd"
# fd -u '.*etc/passwd'
# fd -u '.*/etc/passwd'
# fd -u '[.]+etc/passwd'
# fd -u '[.]+/etc/passwd'

I have to basically grep to get it:

# fd passwd | grep -i "etc/passwd$"
backup/etc/passwd
backup/timeshift/snapshots/2024-05-07_22-43-16/localhost/etc/passwd

Am I missing something?

Describe what you expected to happen:

The regex should match

What version of fd are you using?

fd 10.0.0

Which operating system / distribution are you on?

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.1 LTS
Release:        22.04
Codename:       jammy
tmccombs commented 6 months ago

By default fd only matches against the basename. To get something with multiple components you need to use the --full-path or -p option.

ossie-git commented 6 months ago

Thanks