From owner-freebsd-newbies Tue May 23 4:54:46 2000 Delivered-To: freebsd-newbies@freebsd.org Received: from mail2.svr.pol.co.uk (mail2.svr.pol.co.uk [195.92.193.210]) by hub.freebsd.org (Postfix) with ESMTP id 7B8ED37B783 for ; Tue, 23 May 2000 04:54:39 -0700 (PDT) (envelope-from merlin@netlink.co.uk) Received: from modem-11.monkeyface-eel.dialup.pol.co.uk ([62.137.40.139] helo=A470.com) by mail2.svr.pol.co.uk with esmtp (Exim 3.13 #0) id 12uDGd-0004uW-00 for freebsd-newbies@FreeBSD.org; Tue, 23 May 2000 12:54:36 +0100 Received: (qmail 86661 invoked by uid 1012); 23 May 2000 01:30:28 -0000 Date: Tue, 23 May 2000 01:30:28 +0000 From: Darren Wyn Rees Cc: freebsd-newbies@FreeBSD.org Subject: Re: batch; the other way around Message-ID: <20000523013028.T38637@netlink.co.uk> References: <20000522133131.95845.qmail@hotmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2i In-Reply-To: <20000522133131.95845.qmail@hotmail.com>; from midios3@hotmail.com on Mon, May 22, 2000 at 01:31:31PM +0000 Organization: A470 X-No-Archive: yes X-PGP-812C54B1: F8 79 5E 84 F0 20 A5 62 FA 2D E9 BD BE 06 7D 10 Sender: owner-freebsd-newbies@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org On Mon, May 22, 2000 at 01:31:31PM +0000, Dimitrios T. wrote: > for f in * > do > mv $f $f.txt > done > > Usefull, indeed. But how can one remove the 'txt' from those files (renaming > them back to the original filename). for f in * do FNEW=`echo $f | sed -e 's/\.txt$//'` mv $f $FNEW done The above will only delete '.txt' if it appears at the end of the file. Embellish at will... [t|T][x|X][t|T] To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-newbies" in the body of the message