[wplug] changing extensions?
Mike Griffin
mike at nbi.edu
Tue Mar 27 15:18:06 EST 2007
If you forget 'basename', remember you can use 'cut' in pretty much the same
fashion.
for i in *.htm; do mv $i `ls $i | cut -d\. -f1`.html; done
-----Original Message-----
From: wplug-bounces+mike=nbi.edu at wplug.org
[mailto:wplug-bounces+mike=nbi.edu at wplug.org] On Behalf Of Moshe Katz-Hyman
Sent: Tuesday, March 27, 2007 1:51 PM
To: General user list
Subject: ***SPAM*** Re: [wplug] changing extensions?
I had forgotten basename did that. I always end up mucking around with bash
${pattern%%suffix} subsititutions which I invariably screw up (most likely
that one, too), having to go back to the the man page, then just saying,
"Aw, screw it!" and doing it by hand. :P
Moshe
On 3/27/07, Mike Griffin <mike at nbi.edu> wrote:
>
> Easy enough to add a letter to the end of a file name, but let's
> change the entire file extension to answer later questions.
>
> for i in *.htm; do mv $i `basename $i .htm`.html; done
More information about the wplug
mailing list