From owner-freebsd-questions Mon Sep 25 6: 3:44 2000 Delivered-To: freebsd-questions@freebsd.org Received: from pcwin002.win.tue.nl (pcwin002.win.tue.nl [131.155.71.72]) by hub.freebsd.org (Postfix) with ESMTP id BDD1F37B509 for ; Mon, 25 Sep 2000 06:03:02 -0700 (PDT) Received: by pcwin002.win.tue.nl (Postfix, from userid 1001) id F2E9F1344E; Mon, 25 Sep 2000 15:02:23 +0200 (CEST) Date: Mon, 25 Sep 2000 15:02:23 +0200 From: Stijn Hoop To: "Dimitri T." Cc: freebsd-questions@freebsd.org Subject: Re: how do I get rid of that prefix?! Message-ID: <20000925150223.A15215@pcwin002.win.tue.nl> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from midios4@hotmail.com on Mon, Sep 25, 2000 at 12:36:43PM +0000 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hi, > I have some hundreds of files with a filename starting with a specific > prefix (lets say 'abc') and I want to rename them and get rid of this > prefix. How do I do that? In sh: for i in abc-*; do mv "$i" "`echo $i | sed s/abc-//`"; done In tcsh: foreach i (abc-*) mv "$i" "`echo $i | sed s/abc-//`" end Question from me: how can I put this foreach loop on one line in an interactive tcsh? --Stijn To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message