[wplug] changing extensions?

James O'Kane jo2y at midnightlinux.com
Wed Mar 28 11:16:26 EST 2007


On Tue, 27 Mar 2007, Mike Griffin wrote:

>
> 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

$ ls
odd.name.htm
$ for i in *.htm; do mv $i `ls $i | cut -d\. -f1`.html; done
$ ls
odd.html




>
>
>
> -----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
>
> _______________________________________________
> wplug mailing list
> wplug at wplug.org
> http://www.wplug.org/mailman/listinfo/wplug
>


More information about the wplug mailing list