Capture log files that ended with any number
Clash Royale CLAN TAG#URR8PPP
up vote
-1
down vote
favorite
We want to capture all logs that ended with ".log.[any number]
So I create this syntax
find . -type f -regex '^.log.*[0-9]$' -print
command does not give any output
But this doesn't capture the files as the following ( expected results )
controller.log.2018-01-03-01
server.log.2017-10-31-03
server.log.2018-01-23-11
server.log.2018-04-06-17
server.log.2018-07-07-05
controller.log.2018-01-03-02
log-cleaner.log.10
server.log.2017-10-31-04
server.log.2018-01-23-12
server.log.2018-04-06-18
server.log.2018-07-07-06
controller.log.2018-01-03-03
log-cleaner.log.2
server.log.232.434
what is wrong with my syntax ?
linux files find regular-expression
add a comment |Â
up vote
-1
down vote
favorite
We want to capture all logs that ended with ".log.[any number]
So I create this syntax
find . -type f -regex '^.log.*[0-9]$' -print
command does not give any output
But this doesn't capture the files as the following ( expected results )
controller.log.2018-01-03-01
server.log.2017-10-31-03
server.log.2018-01-23-11
server.log.2018-04-06-17
server.log.2018-07-07-05
controller.log.2018-01-03-02
log-cleaner.log.10
server.log.2017-10-31-04
server.log.2018-01-23-12
server.log.2018-04-06-18
server.log.2018-07-07-06
controller.log.2018-01-03-03
log-cleaner.log.2
server.log.232.434
what is wrong with my syntax ?
linux files find regular-expression
why do we use^
and.
should be escaped
â msp9011
Aug 29 at 10:14
1
Why use a regex?find /var/log -type f -name *.log.*[0-9]
No escaping of dots needed, etc. If you want to find Logs LOGS and logs, then change the-name
to-iname
â ivanivan
Aug 29 at 21:53
add a comment |Â
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
We want to capture all logs that ended with ".log.[any number]
So I create this syntax
find . -type f -regex '^.log.*[0-9]$' -print
command does not give any output
But this doesn't capture the files as the following ( expected results )
controller.log.2018-01-03-01
server.log.2017-10-31-03
server.log.2018-01-23-11
server.log.2018-04-06-17
server.log.2018-07-07-05
controller.log.2018-01-03-02
log-cleaner.log.10
server.log.2017-10-31-04
server.log.2018-01-23-12
server.log.2018-04-06-18
server.log.2018-07-07-06
controller.log.2018-01-03-03
log-cleaner.log.2
server.log.232.434
what is wrong with my syntax ?
linux files find regular-expression
We want to capture all logs that ended with ".log.[any number]
So I create this syntax
find . -type f -regex '^.log.*[0-9]$' -print
command does not give any output
But this doesn't capture the files as the following ( expected results )
controller.log.2018-01-03-01
server.log.2017-10-31-03
server.log.2018-01-23-11
server.log.2018-04-06-17
server.log.2018-07-07-05
controller.log.2018-01-03-02
log-cleaner.log.10
server.log.2017-10-31-04
server.log.2018-01-23-12
server.log.2018-04-06-18
server.log.2018-07-07-06
controller.log.2018-01-03-03
log-cleaner.log.2
server.log.232.434
what is wrong with my syntax ?
linux files find regular-expression
linux files find regular-expression
edited Aug 29 at 10:42
msp9011
3,46643862
3,46643862
asked Aug 29 at 9:26
yael
2,0391245
2,0391245
why do we use^
and.
should be escaped
â msp9011
Aug 29 at 10:14
1
Why use a regex?find /var/log -type f -name *.log.*[0-9]
No escaping of dots needed, etc. If you want to find Logs LOGS and logs, then change the-name
to-iname
â ivanivan
Aug 29 at 21:53
add a comment |Â
why do we use^
and.
should be escaped
â msp9011
Aug 29 at 10:14
1
Why use a regex?find /var/log -type f -name *.log.*[0-9]
No escaping of dots needed, etc. If you want to find Logs LOGS and logs, then change the-name
to-iname
â ivanivan
Aug 29 at 21:53
why do we use
^
and .
should be escapedâ msp9011
Aug 29 at 10:14
why do we use
^
and .
should be escapedâ msp9011
Aug 29 at 10:14
1
1
Why use a regex?
find /var/log -type f -name *.log.*[0-9]
No escaping of dots needed, etc. If you want to find Logs LOGS and logs, then change the -name
to -iname
â ivanivan
Aug 29 at 21:53
Why use a regex?
find /var/log -type f -name *.log.*[0-9]
No escaping of dots needed, etc. If you want to find Logs LOGS and logs, then change the -name
to -iname
â ivanivan
Aug 29 at 21:53
add a comment |Â
4 Answers
4
active
oldest
votes
up vote
1
down vote
accepted
-regex
(a GNU extension also recognised by some other find
implementations nowadays but with major differences) is like -path
except that it uses regexps instead of wildcards. It matches on the whole file path, not just its name.
So .*.log.*[0-9]
(no need for ^
or $
by the way, they're implicit with find
's -regex
) would match on ./dir/foo.log-3
but also ./foo.logic/file.bz2
, where the .*
captured ic/file.bz
.
-name
matches on the file name only, uses wildcards but doesn't have a regexp counterpart. Here, for files whose name contain .log
and end in a digit, you don't need regexps anyway, -name '*.foo*[0-9]'
.
You can do the same with regexps though with -regex '.*.log[^/]*[0-9]'
, that is making sure the part between .log
and the final digit doesn't contain any /
so it matches on the file name only.
With -regex
, you can go further in specifying the patterns, especially if you enable extended regexps, using -E
with some BSD's find
or -regextype posix-extended
with GNU find
.
find . -regextype posix-extended -regex '.*.log([.-][0-9]+)+' # GNU
find -E . -regex '.*.log([.-][0-9]+)+' # BSD
Here matching on .log
followed by one or more .<number>
or -<number>
.
Without -regextype posix-extended
GNU find
's regexps are emacs regexps, some sort of hybrid between standard basic regexps and standard extended regexps (supports +
, but grouping is with (...)
instead of (...)
).
Without -E
BSD find
regexps are standard basic regexps.
add a comment |Â
up vote
0
down vote
Try,
find . -type f -regex ".*.log..*[0-9]$"
./server.log.2018-01-23-12
./server.log.2018-07-07-06
./log-cleaner.log.2
./log-cleaner.log.10
./server.log.232.434
./server.log.2018-01-23-11
./server.log.2017-10-31-03
./controller.log.2018-01-03-01
./server.log.2018-04-06-17
./log-cleaner.log.1
./controller.log.2018-01-03-03
./server.log.2018-04-06-18
./controller.log.2018-01-03-02
./server.log.2018-07-07-05
./server.log.2017-10-31-04
- we need to escape the
.
this syntax not works
â yael
Aug 29 at 10:31
@yeal can you share the error
â msp9011
Aug 29 at 10:33
it si just print only the file - gc.log.0 , but all other are not printed
â yael
Aug 29 at 10:34
yes I already did it
â yael
Aug 29 at 10:38
what you mean ?
â yael
Aug 29 at 10:48
 |Â
show 1 more comment
up vote
0
down vote
If after "log" there's only digits, .
, and -
, the following might work as well
find . -type f -regex ".*[.]log[-.0-9]*$"
add a comment |Â
up vote
0
down vote
You could search for your files using the following way without recourse to non-GNU
find
:
find . -type f
( -name '?*.log.[0-9]' -o
(
-name '?*.log.[0-9]*[0-9]'
! -name '?*.log.?*[!0-9.-]*?'
! -name '?*.log.?*[.-][.-]*?'
)
)
-print;
What this does is do a multi-layered filtering of the filenames caught by it and progressively shrinks the catch and zeroes in on the required. To be precise:
- Right away select any file whose
basename
, i.e., w/o it's path ends in a.log.single_digit
- OTW, select those that end in
.log.
NUM
anything
NUM
This will set the trend for the filenames to be caught in the net. - Out of the above catch, reject those which happen to have a
non number, non dash, or non dot
in theanything
portion of the filename. Note the trend of beginning and ending with a digit must be honored. - Now our catch has all those files in which
anything
portion comprises onlydigit(s)
,dot(s)
, anddash(s)
. The last constraint is that thedot
ordash
must not have each as their immediate neighbors to both their left and right. - P.S. Note that
-name
option looks at the basename portion of the filename only, AND -name
portion operates on thewildcard
basis and hence they are implicitly anchored, meaning the name matched is full.
add a comment |Â
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
-regex
(a GNU extension also recognised by some other find
implementations nowadays but with major differences) is like -path
except that it uses regexps instead of wildcards. It matches on the whole file path, not just its name.
So .*.log.*[0-9]
(no need for ^
or $
by the way, they're implicit with find
's -regex
) would match on ./dir/foo.log-3
but also ./foo.logic/file.bz2
, where the .*
captured ic/file.bz
.
-name
matches on the file name only, uses wildcards but doesn't have a regexp counterpart. Here, for files whose name contain .log
and end in a digit, you don't need regexps anyway, -name '*.foo*[0-9]'
.
You can do the same with regexps though with -regex '.*.log[^/]*[0-9]'
, that is making sure the part between .log
and the final digit doesn't contain any /
so it matches on the file name only.
With -regex
, you can go further in specifying the patterns, especially if you enable extended regexps, using -E
with some BSD's find
or -regextype posix-extended
with GNU find
.
find . -regextype posix-extended -regex '.*.log([.-][0-9]+)+' # GNU
find -E . -regex '.*.log([.-][0-9]+)+' # BSD
Here matching on .log
followed by one or more .<number>
or -<number>
.
Without -regextype posix-extended
GNU find
's regexps are emacs regexps, some sort of hybrid between standard basic regexps and standard extended regexps (supports +
, but grouping is with (...)
instead of (...)
).
Without -E
BSD find
regexps are standard basic regexps.
add a comment |Â
up vote
1
down vote
accepted
-regex
(a GNU extension also recognised by some other find
implementations nowadays but with major differences) is like -path
except that it uses regexps instead of wildcards. It matches on the whole file path, not just its name.
So .*.log.*[0-9]
(no need for ^
or $
by the way, they're implicit with find
's -regex
) would match on ./dir/foo.log-3
but also ./foo.logic/file.bz2
, where the .*
captured ic/file.bz
.
-name
matches on the file name only, uses wildcards but doesn't have a regexp counterpart. Here, for files whose name contain .log
and end in a digit, you don't need regexps anyway, -name '*.foo*[0-9]'
.
You can do the same with regexps though with -regex '.*.log[^/]*[0-9]'
, that is making sure the part between .log
and the final digit doesn't contain any /
so it matches on the file name only.
With -regex
, you can go further in specifying the patterns, especially if you enable extended regexps, using -E
with some BSD's find
or -regextype posix-extended
with GNU find
.
find . -regextype posix-extended -regex '.*.log([.-][0-9]+)+' # GNU
find -E . -regex '.*.log([.-][0-9]+)+' # BSD
Here matching on .log
followed by one or more .<number>
or -<number>
.
Without -regextype posix-extended
GNU find
's regexps are emacs regexps, some sort of hybrid between standard basic regexps and standard extended regexps (supports +
, but grouping is with (...)
instead of (...)
).
Without -E
BSD find
regexps are standard basic regexps.
add a comment |Â
up vote
1
down vote
accepted
up vote
1
down vote
accepted
-regex
(a GNU extension also recognised by some other find
implementations nowadays but with major differences) is like -path
except that it uses regexps instead of wildcards. It matches on the whole file path, not just its name.
So .*.log.*[0-9]
(no need for ^
or $
by the way, they're implicit with find
's -regex
) would match on ./dir/foo.log-3
but also ./foo.logic/file.bz2
, where the .*
captured ic/file.bz
.
-name
matches on the file name only, uses wildcards but doesn't have a regexp counterpart. Here, for files whose name contain .log
and end in a digit, you don't need regexps anyway, -name '*.foo*[0-9]'
.
You can do the same with regexps though with -regex '.*.log[^/]*[0-9]'
, that is making sure the part between .log
and the final digit doesn't contain any /
so it matches on the file name only.
With -regex
, you can go further in specifying the patterns, especially if you enable extended regexps, using -E
with some BSD's find
or -regextype posix-extended
with GNU find
.
find . -regextype posix-extended -regex '.*.log([.-][0-9]+)+' # GNU
find -E . -regex '.*.log([.-][0-9]+)+' # BSD
Here matching on .log
followed by one or more .<number>
or -<number>
.
Without -regextype posix-extended
GNU find
's regexps are emacs regexps, some sort of hybrid between standard basic regexps and standard extended regexps (supports +
, but grouping is with (...)
instead of (...)
).
Without -E
BSD find
regexps are standard basic regexps.
-regex
(a GNU extension also recognised by some other find
implementations nowadays but with major differences) is like -path
except that it uses regexps instead of wildcards. It matches on the whole file path, not just its name.
So .*.log.*[0-9]
(no need for ^
or $
by the way, they're implicit with find
's -regex
) would match on ./dir/foo.log-3
but also ./foo.logic/file.bz2
, where the .*
captured ic/file.bz
.
-name
matches on the file name only, uses wildcards but doesn't have a regexp counterpart. Here, for files whose name contain .log
and end in a digit, you don't need regexps anyway, -name '*.foo*[0-9]'
.
You can do the same with regexps though with -regex '.*.log[^/]*[0-9]'
, that is making sure the part between .log
and the final digit doesn't contain any /
so it matches on the file name only.
With -regex
, you can go further in specifying the patterns, especially if you enable extended regexps, using -E
with some BSD's find
or -regextype posix-extended
with GNU find
.
find . -regextype posix-extended -regex '.*.log([.-][0-9]+)+' # GNU
find -E . -regex '.*.log([.-][0-9]+)+' # BSD
Here matching on .log
followed by one or more .<number>
or -<number>
.
Without -regextype posix-extended
GNU find
's regexps are emacs regexps, some sort of hybrid between standard basic regexps and standard extended regexps (supports +
, but grouping is with (...)
instead of (...)
).
Without -E
BSD find
regexps are standard basic regexps.
answered Aug 29 at 22:06
Stéphane Chazelas
286k53527866
286k53527866
add a comment |Â
add a comment |Â
up vote
0
down vote
Try,
find . -type f -regex ".*.log..*[0-9]$"
./server.log.2018-01-23-12
./server.log.2018-07-07-06
./log-cleaner.log.2
./log-cleaner.log.10
./server.log.232.434
./server.log.2018-01-23-11
./server.log.2017-10-31-03
./controller.log.2018-01-03-01
./server.log.2018-04-06-17
./log-cleaner.log.1
./controller.log.2018-01-03-03
./server.log.2018-04-06-18
./controller.log.2018-01-03-02
./server.log.2018-07-07-05
./server.log.2017-10-31-04
- we need to escape the
.
this syntax not works
â yael
Aug 29 at 10:31
@yeal can you share the error
â msp9011
Aug 29 at 10:33
it si just print only the file - gc.log.0 , but all other are not printed
â yael
Aug 29 at 10:34
yes I already did it
â yael
Aug 29 at 10:38
what you mean ?
â yael
Aug 29 at 10:48
 |Â
show 1 more comment
up vote
0
down vote
Try,
find . -type f -regex ".*.log..*[0-9]$"
./server.log.2018-01-23-12
./server.log.2018-07-07-06
./log-cleaner.log.2
./log-cleaner.log.10
./server.log.232.434
./server.log.2018-01-23-11
./server.log.2017-10-31-03
./controller.log.2018-01-03-01
./server.log.2018-04-06-17
./log-cleaner.log.1
./controller.log.2018-01-03-03
./server.log.2018-04-06-18
./controller.log.2018-01-03-02
./server.log.2018-07-07-05
./server.log.2017-10-31-04
- we need to escape the
.
this syntax not works
â yael
Aug 29 at 10:31
@yeal can you share the error
â msp9011
Aug 29 at 10:33
it si just print only the file - gc.log.0 , but all other are not printed
â yael
Aug 29 at 10:34
yes I already did it
â yael
Aug 29 at 10:38
what you mean ?
â yael
Aug 29 at 10:48
 |Â
show 1 more comment
up vote
0
down vote
up vote
0
down vote
Try,
find . -type f -regex ".*.log..*[0-9]$"
./server.log.2018-01-23-12
./server.log.2018-07-07-06
./log-cleaner.log.2
./log-cleaner.log.10
./server.log.232.434
./server.log.2018-01-23-11
./server.log.2017-10-31-03
./controller.log.2018-01-03-01
./server.log.2018-04-06-17
./log-cleaner.log.1
./controller.log.2018-01-03-03
./server.log.2018-04-06-18
./controller.log.2018-01-03-02
./server.log.2018-07-07-05
./server.log.2017-10-31-04
- we need to escape the
.
Try,
find . -type f -regex ".*.log..*[0-9]$"
./server.log.2018-01-23-12
./server.log.2018-07-07-06
./log-cleaner.log.2
./log-cleaner.log.10
./server.log.232.434
./server.log.2018-01-23-11
./server.log.2017-10-31-03
./controller.log.2018-01-03-01
./server.log.2018-04-06-17
./log-cleaner.log.1
./controller.log.2018-01-03-03
./server.log.2018-04-06-18
./controller.log.2018-01-03-02
./server.log.2018-07-07-05
./server.log.2017-10-31-04
- we need to escape the
.
answered Aug 29 at 10:15
msp9011
3,46643862
3,46643862
this syntax not works
â yael
Aug 29 at 10:31
@yeal can you share the error
â msp9011
Aug 29 at 10:33
it si just print only the file - gc.log.0 , but all other are not printed
â yael
Aug 29 at 10:34
yes I already did it
â yael
Aug 29 at 10:38
what you mean ?
â yael
Aug 29 at 10:48
 |Â
show 1 more comment
this syntax not works
â yael
Aug 29 at 10:31
@yeal can you share the error
â msp9011
Aug 29 at 10:33
it si just print only the file - gc.log.0 , but all other are not printed
â yael
Aug 29 at 10:34
yes I already did it
â yael
Aug 29 at 10:38
what you mean ?
â yael
Aug 29 at 10:48
this syntax not works
â yael
Aug 29 at 10:31
this syntax not works
â yael
Aug 29 at 10:31
@yeal can you share the error
â msp9011
Aug 29 at 10:33
@yeal can you share the error
â msp9011
Aug 29 at 10:33
it si just print only the file - gc.log.0 , but all other are not printed
â yael
Aug 29 at 10:34
it si just print only the file - gc.log.0 , but all other are not printed
â yael
Aug 29 at 10:34
yes I already did it
â yael
Aug 29 at 10:38
yes I already did it
â yael
Aug 29 at 10:38
what you mean ?
â yael
Aug 29 at 10:48
what you mean ?
â yael
Aug 29 at 10:48
 |Â
show 1 more comment
up vote
0
down vote
If after "log" there's only digits, .
, and -
, the following might work as well
find . -type f -regex ".*[.]log[-.0-9]*$"
add a comment |Â
up vote
0
down vote
If after "log" there's only digits, .
, and -
, the following might work as well
find . -type f -regex ".*[.]log[-.0-9]*$"
add a comment |Â
up vote
0
down vote
up vote
0
down vote
If after "log" there's only digits, .
, and -
, the following might work as well
find . -type f -regex ".*[.]log[-.0-9]*$"
If after "log" there's only digits, .
, and -
, the following might work as well
find . -type f -regex ".*[.]log[-.0-9]*$"
answered Aug 29 at 20:34
RudiC
1,2498
1,2498
add a comment |Â
add a comment |Â
up vote
0
down vote
You could search for your files using the following way without recourse to non-GNU
find
:
find . -type f
( -name '?*.log.[0-9]' -o
(
-name '?*.log.[0-9]*[0-9]'
! -name '?*.log.?*[!0-9.-]*?'
! -name '?*.log.?*[.-][.-]*?'
)
)
-print;
What this does is do a multi-layered filtering of the filenames caught by it and progressively shrinks the catch and zeroes in on the required. To be precise:
- Right away select any file whose
basename
, i.e., w/o it's path ends in a.log.single_digit
- OTW, select those that end in
.log.
NUM
anything
NUM
This will set the trend for the filenames to be caught in the net. - Out of the above catch, reject those which happen to have a
non number, non dash, or non dot
in theanything
portion of the filename. Note the trend of beginning and ending with a digit must be honored. - Now our catch has all those files in which
anything
portion comprises onlydigit(s)
,dot(s)
, anddash(s)
. The last constraint is that thedot
ordash
must not have each as their immediate neighbors to both their left and right. - P.S. Note that
-name
option looks at the basename portion of the filename only, AND -name
portion operates on thewildcard
basis and hence they are implicitly anchored, meaning the name matched is full.
add a comment |Â
up vote
0
down vote
You could search for your files using the following way without recourse to non-GNU
find
:
find . -type f
( -name '?*.log.[0-9]' -o
(
-name '?*.log.[0-9]*[0-9]'
! -name '?*.log.?*[!0-9.-]*?'
! -name '?*.log.?*[.-][.-]*?'
)
)
-print;
What this does is do a multi-layered filtering of the filenames caught by it and progressively shrinks the catch and zeroes in on the required. To be precise:
- Right away select any file whose
basename
, i.e., w/o it's path ends in a.log.single_digit
- OTW, select those that end in
.log.
NUM
anything
NUM
This will set the trend for the filenames to be caught in the net. - Out of the above catch, reject those which happen to have a
non number, non dash, or non dot
in theanything
portion of the filename. Note the trend of beginning and ending with a digit must be honored. - Now our catch has all those files in which
anything
portion comprises onlydigit(s)
,dot(s)
, anddash(s)
. The last constraint is that thedot
ordash
must not have each as their immediate neighbors to both their left and right. - P.S. Note that
-name
option looks at the basename portion of the filename only, AND -name
portion operates on thewildcard
basis and hence they are implicitly anchored, meaning the name matched is full.
add a comment |Â
up vote
0
down vote
up vote
0
down vote
You could search for your files using the following way without recourse to non-GNU
find
:
find . -type f
( -name '?*.log.[0-9]' -o
(
-name '?*.log.[0-9]*[0-9]'
! -name '?*.log.?*[!0-9.-]*?'
! -name '?*.log.?*[.-][.-]*?'
)
)
-print;
What this does is do a multi-layered filtering of the filenames caught by it and progressively shrinks the catch and zeroes in on the required. To be precise:
- Right away select any file whose
basename
, i.e., w/o it's path ends in a.log.single_digit
- OTW, select those that end in
.log.
NUM
anything
NUM
This will set the trend for the filenames to be caught in the net. - Out of the above catch, reject those which happen to have a
non number, non dash, or non dot
in theanything
portion of the filename. Note the trend of beginning and ending with a digit must be honored. - Now our catch has all those files in which
anything
portion comprises onlydigit(s)
,dot(s)
, anddash(s)
. The last constraint is that thedot
ordash
must not have each as their immediate neighbors to both their left and right. - P.S. Note that
-name
option looks at the basename portion of the filename only, AND -name
portion operates on thewildcard
basis and hence they are implicitly anchored, meaning the name matched is full.
You could search for your files using the following way without recourse to non-GNU
find
:
find . -type f
( -name '?*.log.[0-9]' -o
(
-name '?*.log.[0-9]*[0-9]'
! -name '?*.log.?*[!0-9.-]*?'
! -name '?*.log.?*[.-][.-]*?'
)
)
-print;
What this does is do a multi-layered filtering of the filenames caught by it and progressively shrinks the catch and zeroes in on the required. To be precise:
- Right away select any file whose
basename
, i.e., w/o it's path ends in a.log.single_digit
- OTW, select those that end in
.log.
NUM
anything
NUM
This will set the trend for the filenames to be caught in the net. - Out of the above catch, reject those which happen to have a
non number, non dash, or non dot
in theanything
portion of the filename. Note the trend of beginning and ending with a digit must be honored. - Now our catch has all those files in which
anything
portion comprises onlydigit(s)
,dot(s)
, anddash(s)
. The last constraint is that thedot
ordash
must not have each as their immediate neighbors to both their left and right. - P.S. Note that
-name
option looks at the basename portion of the filename only, AND -name
portion operates on thewildcard
basis and hence they are implicitly anchored, meaning the name matched is full.
answered Sep 2 at 5:43
Rakesh Sharma
60513
60513
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f465459%2fcapture-log-files-that-ended-with-any-number%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
why do we use
^
and.
should be escapedâ msp9011
Aug 29 at 10:14
1
Why use a regex?
find /var/log -type f -name *.log.*[0-9]
No escaping of dots needed, etc. If you want to find Logs LOGS and logs, then change the-name
to-iname
â ivanivan
Aug 29 at 21:53