[clug] Shell glob for a range of numbers?

McClure, Mike MikeMcClure at ap.spherion.com
Thu Jan 8 22:42:29 GMT 2004

> From: Kim Holburn [mailto:kim.holburn at anu.edu.au]
> >I've got a bunch of files, named say argus.log.5.gz -> 
> argus.log.21.gz
> >
> >I wish there was a ".." operator/regex thingy.
> glob has "?"
> as in :
> cp argus.log.?.gz argus.log.[12]?.gz /tmp

i presumed that argus.log.22.gz exists but does not want
to be copied.
in which case your glob would copy the unwanted file.

in a private reply yesterday i suggested this:
"cp argus.log.{[5-9],1[0-9],2[01]}.gz /tmp"

which doesn't have backticks, pipes or loops.


The information contained in this email and any attachments to it:

(a) may be confidential and if you are not the intended recipient, any interference with, 
use, disclosure or copying of this material is unauthorised and prohibited; and

(b) may contain personal information of the recipient and/or the sender as defined 
under the Privacy Act 1988 (Cth). Consent is hereby given by the recipient(s) to 
collect, hold and use such information and any personal information contained in a 
response to this email, for any reasonable purpose in the ordinary course of 
business, including forwarding this email internally or disclosing it to a third party. All 
personal information collected by Spherion will be handled in accordance with 
Spherion's Privacy Policy. If you have received this email in error, please notify the 
sender and delete it.

(c) you agree not to employ or arrange employment for any candidate(s) supplied in 
this email and any attachments without first entering into a contractual agreement with 
Spherion. You further agree not to divulge any information contained in this document 
to any person(s) or entities without the express permission of Spherion.

More information about the linux mailing list