0
grep -lw  -e '0123456789' application.log_2023-07-*

I want logs greater than 2023-07-*, how do I achieve it?

Similar Question:

grep particular log entry greater than specific time

  • 1
    In your case, does greater than 2023-07-* includes July (greater and equal), or only starting from August (08)? Also, does it have to be based on the file name, or by the file's last change/modification time, regardless of the name? – aviro Aug 08 '23 at 08:29
  • includes july. only name nothing to do with modification time. KISS. – achhainsan Aug 08 '23 at 08:58

1 Answers1

0

You'll need to use at least two patterns (in the same line), one for 7-9 and one for 10-22.

application.log_2023-0[7-9]-* application.log_2023-1[0-2]-* 

If you also want the same command to work at the next year(s), also add wildcard for the year.

application.log_202[4-9]-*-*
aviro
  • 5,532