in reply to Acceptable regular expressions within command line type syntax
However, you can use Perl to feed a list of file names to tar. You can opendir, grep, and then pipe the list to tar. Something like this (untested):
Update: the print line should beopendir DIR, $logs or die "Cannot open dir $logs: $!\n"; my @files = grep /^access_log\.\d+\.gz$/, readdir DIR; close DIR; open TAR, "|tar -czpf $target_file - >savetarout" or die "Cannot open tar: $!\n"; print TAR $_, "\n" for @files; close TAR or die "error closing TAR: $!\n";
print TAR "$logs/$_\n" for @files;
|
|---|