Naga Vemprala
Naga Vemprala

Reputation: 728

Find a file with a matching pattern in Linux

I am trying to find a file in Linux box. It ends with a timestamp pattern, e.g:

I tried finding this file using command:

find . -name "MY_TEST_FILE_1_[0-9][0-9][0-9][0-9][0-9][0-9].log" -print 

and it listed all the log files for the day.

When I tried the same thing as:

find . -name "MY_TEST_FILE_1_[0-9]{6}.log" -print

I am not able to list any.

Could you please tell me where am I going wrong?

Upvotes: 1

Views: 74

Answers (1)

Sobrique
Sobrique

Reputation: 53478

A shellglob pattern is not the same as a regex.

Try 'find -regex' instead.

Upvotes: 3

Related Questions