[X-Unix] What unix command ?

Ken Rossman rossman at columbia.edu
Mon Sep 26 13:14:27 PDT 2005


Here is yet another way to do a mass rename (I do this all the time),  
using
built-in features of the default unix shell under Mac OS X -- bash:

   $ for i in *eml..txt; do echo $i; mv $i $i{%%eml..txt}.txt; done

See the man pages for an explanation of '##' and '%%' shell variable
modifiers.  These are quite useful.

By the way, the above might be more politely written in a multi-line  
format
in a separate script file, but writing it in the above fashion, all  
on one
line, with semicolons for line separators, makes it easy for me to  
command-
line-edit the program if I goofed it up the first few times.  I can just
recall the command, edit, and re-execute it (I use the emacs-mode  
editing,
but vi-mode editing is also available).

KR

On Sep 26, 2005, at 2:24 PM, Richard Nagle wrote:

> Looking for a unix command's that can do the following:
>
> inside a folder on my desktop, there are txt documents,
> that I need to fix the file names...
>
> ie:
>
> message: fixing the mac power supplyeml..txt
>
>     Now look at the end of this message, its a .txt file,
>     however, I need to do this:....
>
>     going backwards, from ; .txt and remove the eml,
>     then slide over the .txt,
>
> So the end results are;
> message: fixing the mac power supply.txt
>
>
> I've got 1000's of messages like this,
> its a plugin filter, that adds this eml.
> to every email message...that are exported
>
> I did in fact Contact the author, 3 months ago.
> N/A as of yet.
>
> Thanks all...
> Richard
>
>
>
> -- 
>
> I will not be pushed, filed, stamped, indexed, briefed, debriefed,  
> or numbered!
> My life is my own - No. 6
> _______________________________________________
> X-Unix mailing list
> X-Unix at listserver.themacintoshguy.com
> http://listserver.themacintoshguy.com/mailman/listinfo/x-unix
>
> Listmom is trying to clean out his closets! Vintage Mac and random  
> stuff:
>         http://search.ebay.com/_W0QQsassZmacguy1984
>

Ken Rossman
rossman at columbia.edu
973-509-7669 (home)
973-202-0974 (cell)




More information about the X-Unix mailing list