Excellent. Thanks. 

brian

On Fri, Sep 04, 2015 at 07:41:16AM -0700, Wes Hardaker wrote:
> "Brian E. Lavender" <br...@brie.com> writes:
> 
> > Shell command that does the following.
> >
> > rename "s/^/foo/" *.txt
> 
> I think I posted it a long time ago.  It was written before the command
> line rename program existed, so there wasn't a conflict.
> 
> #!/usr/bin/perl
> 
> ($op = shift) || die "Usage: rename expr [files]]\n";
> 
> if(!@ARGV)
>   {
>   @ARGV = <STDIN>;
>   chop(@ARGV);
>   }
> 
> for (@ARGV)
>   {
>   $was = $_;
>   eval $op;
>   die $@ if $@;
> 
>   if ($was ne $_)
>     {
>     print "rename($was,$_)\n";
>     rename($was,$_);
>     }
>   }
> 
> exit;
> 
> -- 
> Wes Hardaker                                     
> My Pictures:       http://capturedonearth.com/
> My Thoughts:       http://pontifications.hardakers.net/

-- 
Brian Lavender
http://www.brie.com/brian/

"There are two ways of constructing a software design. One way is to
make it so simple that there are obviously no deficiencies. And the other
way is to make it so complicated that there are no obvious deficiencies."

Professor C. A. R. Hoare
The 1980 Turing award lecture
_______________________________________________
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech

Reply via email to