From owner-freebsd-questions Tue Sep 24 16:39:16 1996 Return-Path: owner-questions Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id QAA13384 for questions-outgoing; Tue, 24 Sep 1996 16:39:16 -0700 (PDT) Received: from horst.bfd.com (horst.bfd.com [204.160.242.10]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id QAA13351 for ; Tue, 24 Sep 1996 16:39:11 -0700 (PDT) Received: from harlie (bastion.bfd.com [204.160.242.2]) by horst.bfd.com (8.7.5/8.7.3) with SMTP id QAA00406; Tue, 24 Sep 1996 16:38:35 -0700 (PDT) Date: Tue, 24 Sep 1996 16:39:18 -0700 (PDT) From: "Eric J. Schwertfeger" X-Sender: ejs@harlie To: hmmm cc: freebsd-questions Subject: Re: multiple files In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-questions@FreeBSD.org X-Loop: FreeBSD.org Precedence: bulk On Tue, 24 Sep 1996, hmmm wrote: > how can i rename multiple files w/o doing it 1-by-1? > > ie, > > abc.tar.gz > abc.tgz > def.tar.gz > def.tgz > hij.tar.gz > hij.tgz Sounds like a job for perl. But that's too easy so here's a demented way do do it in shell script (sh) (assuming there are no other periods in the file names). for i in *.tar.gz; do mv $i $(echo $i | cut -f 1 -d . ).tgz done