Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 May 2000 01:30:28 +0000
From:      Darren Wyn Rees <merlin@netlink.co.uk>
Cc:        freebsd-newbies@FreeBSD.org
Subject:   Re: batch; the other way around
Message-ID:  <20000523013028.T38637@netlink.co.uk>
In-Reply-To: <20000522133131.95845.qmail@hotmail.com>; from midios3@hotmail.com on Mon, May 22, 2000 at 01:31:31PM %2B0000
References:  <20000522133131.95845.qmail@hotmail.com>

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




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