How can I match a more complex pattern when using cat
or zcat
? For example, I know I can do this:
zcat /var/log/nginx/access.log.*.gz
Which will output all the gzipped access logs to stdin.
What if I want a more complex pattern? Say, all the log files that are between 1-15, e.g. something like this pattern:
zcat /var/log/nginx/access.log.([1-9]|1[0-5]).gz
This results in an unexpected token
which is obvious, but I'm not sure how I'd escape the regex in this situation? Maybe I need to pipe ls
output to zcat instead?