[clug] Shell glob for a range of numbers?

Kim Holburn kim.holburn at anu.edu.au
Thu Jan 8 11:41:45 GMT 2004

At 10:16 AM +1000 2004/01/08, Andrew Pollock wrote:
>It's always bugged me that I can't glob a range of numbers (that I know of).

Actually I think bash has a shopt that will let you use regex instead of glob.

>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'd like to be able to go "cp argus.log.[5..21].gz /tmp" or something like
>that. Unless some regex guru can show me a way of using [] expansion that I
>didn't know of...

Kim Holburn 
Network Consultant - Telecommunications Engineering
Research School of Information Sciences and Engineering
Australian National University - Ph: +61 2 61258620 M: +61 0417820641
Email: kim.holburn at anu.edu.au  - PGP Public Key on request

Life is complex - It has real and imaginary parts.
     Andrea Leistra (rec.arts.sf.written.Robert-jordan)

More information about the linux mailing list