Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Sep 2000 15:02:23 +0200
From:      Stijn Hoop <stijn@win.tue.nl>
To:        "Dimitri T." <midios4@hotmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: how do I get rid of that prefix?!
Message-ID:  <20000925150223.A15215@pcwin002.win.tue.nl>
In-Reply-To: <F2328k69RKLpgTFur2i00003f62@hotmail.com>; from midios4@hotmail.com on Mon, Sep 25, 2000 at 12:36:43PM %2B0000
References:  <F2328k69RKLpgTFur2i00003f62@hotmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000925150223.A15215>