From owner-freebsd-questions Mon Oct 20 09:24:56 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id JAA02994 for questions-outgoing; Mon, 20 Oct 1997 09:24:56 -0700 (PDT) (envelope-from owner-freebsd-questions) Received: from sumatra.americantv.com (sumatra.americantv.com [207.170.17.37]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id JAA02982 for ; Mon, 20 Oct 1997 09:24:50 -0700 (PDT) (envelope-from jlemon@americantv.com) Received: from right.PCS (right.PCS [148.105.10.31]) by sumatra.americantv.com (8.8.5/8.8.5) with ESMTP id LAA12622; Mon, 20 Oct 1997 11:24:09 -0500 (CDT) Received: (from jlemon@localhost) by right.PCS (8.6.13/8.6.4) id LAA18935; Mon, 20 Oct 1997 11:23:37 -0500 Message-ID: <19971020112337.20757@right.PCS> Date: Mon, 20 Oct 1997 11:23:37 -0500 From: Jonathan Lemon To: abbott on blue Cc: questions@FreeBSD.ORG Subject: Re: Unix question. Regular expressions in commands? References: <28262143@toto.iv> <3.0.3.32.19971020101324.00a53e90@blue.pca.state.mn.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.61.1 In-Reply-To: <3.0.3.32.19971020101324.00a53e90@blue.pca.state.mn.us>; from abbott on blue on Oct 10, 1997 at 10:13:24AM -0500 Sender: owner-freebsd-questions@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk On Oct 10, 1997 at 10:13:24AM -0500, abbott on blue wrote: > I guess this is kind of a newbie unix question. I have just learned about > regular expressions within perl and so am trying to use them everyplace. :-) > > >From a command line what I would like to do is.... > # mv *.[dump asc dat txt clean] tablecreation > > but this does not work. I end up having to... > # mv *.dump tablecreation > # mv *.asc tablecreation > # mv *.dat tablecreation > # mv *.txt tablecreation > # mv *.clean tablecreation > > Is there anyway to do regular expression matching within commands? Depends on the shell you use. With tcsh, you can do the following: mv *.{dump,asc,dat,txt,clean} tablecreation I don't think this is possible with sh; other shells may provide the same functionality but with different syntax. -- Jonathan