Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 May 2000 00:55:42 -0700
From:      Doug Barton <DougB@gorean.org>
To:        "Dimitrios T." <midios3@hotmail.com>
Cc:        freebsd-newbies@FreeBSD.org
Subject:   Re: batch; the other way around
Message-ID:  <392A397E.12EA745B@gorean.org>
References:  <20000522133131.95845.qmail@hotmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
"Dimitrios T." wrote:
> 
> hi,
> 
> I like to follow the posts of this mailing-list, I think it's yet another
> way of learning FreeBSD. I liked the following solution of adding a 'txt'
> "extension" (pardon my DOS :-)  after a listing of files:
> 
>    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).
> 
> Is this possible?

	Well, the answer is in the man page for sh, but it's not 100% obvious.
So, I'll tell you, if you promise to go READ the man page to figure out
why it works. :)

for FILE in *.txt; do
mv $FILE ${FILE%\.txt}
done

Doug


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?392A397E.12EA745B>