[clug] Shell glob for a range of numbers?

David Gibson david at gibson.dropbear.id.au
Thu Jan 8 06:25:35 GMT 2004


On Thu, Jan 08, 2004 at 03:35:27PM +1100, Martin Pool wrote:
> On  8 Jan 2004 Kim Holburn <kim.holburn at anu.edu.au> wrote:
> 
> > At 10:16 AM +1000 2004/01/08, Andrew Pollock wrote:
> > >Hi,
> > >
> > >It's always bugged me that I can't glob a range of numbers (that I know of).
> > >
> > >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.
> 
> for i in `seq 5 21`; do cp argus.log.$i.gz /tmp; done

Or, to avoid the loop in an excessively silly way:

eval cp argus.log.\{`seq -s, 5 21`\} /tmp

-- 
David Gibson			| For every complex problem there is a
david at gibson.dropbear.id.au	| solution which is simple, neat and
				| wrong.
http://www.ozlabs.org/people/dgibson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.samba.org/archive/linux/attachments/20040108/06c5e1c8/attachment.bin


More information about the linux mailing list