[clug] Shell glob for a range of numbers?

Steven Hanley sjh at svana.org
Thu Jan 8 00:19:22 GMT 2004


On Thu, Jan 08, 2004 at 10:16:54AM +1000, 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.
> 
> 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...

Off the top of my head I dont know that way, however a quick hack alternate
way would be 

(in bash)

for i in argus.log.`seq 5 21`.gz ; do cp $i /tmp ; done

	See You
	    Steve

-- 
sjh at wibble.net http://svana.org/sjh
You are subtle as a window pane standing in my view
but I will wait for it to rain so that I can see you
   Anticipate - Ani


More information about the linux mailing list