0

Suppose I have a file named

some_file_name.ext

Now I want this file to be found out with find command some part of filename like:

find filelocation -type f -name 'some\|name'

I have tried doing this with grep and awk but with no luck and even tried all command from this link

2
  • Do you want to match files whose names match both some and name? is order important? Commented Nov 7, 2019 at 15:22
  • Order is not important further I want some&name instead of some|name
    – jkp
    Commented Nov 7, 2019 at 15:28

1 Answer 1

3

Arguments to find -name are simple shell globs, and the default conjunction is logical AND - so

find location -type f -name '*some*' -name '*name*'

will find regular files whose names contain both some and name in any order. OTOH if you want to find files whose names contain some and name in order, it's simply

find location -type f -name '*some*name*'

or

find location -type f -name 'some*name*'

if the name should start with the string some.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .