Re: batch job

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Ed
Date:  
To: Main PLUG discussion list
Subject: Re: batch job
On Fri, Aug 5, 2011 at 6:16 PM, Brian Parma <> wrote:
> On 08/05/2011 03:45 PM, Dazed_75 wrote:
>
> I have finished doing the work but did it manually.  For future reference,
> I'd like to re-learn what I forgot from 20+ years ago about how to do this
> the easy way.  Basically, I had a directory full of files that I wanted to
> process all the same way and rename them in the process.  What I could not
> remember was how with globbing, I could specify the output name part that
> was wild-carded in the input should be used in the output.
>
> Lets say I have a bunch of files named Screenshot-PXEmenu-*.png and I want
> to copy or rename them to PXEmenu-*.png.  Both mv and copy fail
> (understandably?) using "<command> Screenshot-PXEmenu-*.png PXEmenu-*.png".
> I am pretty sure there is a way to make one or both work with a syntax for
> the target I do not remember.  Any clues?
>
> The names are real, though what I was really doing was using the convert
> command of ImageMagick to negate all the colors in those screenshots so I
> had a specified input and output file anyway.  NTL, the base question here
> is the real one.
> --
> Dazed_75 a.k.a. Larry
>

Hi Larry, if the files have spaces in them, I make my life easier and
run detox[1] on them first. Otherwise the command rename should do
what you want: rename FROMpattern TOpattern Files

rename Screenshot-PXE PXE Screenshot-PXE*

if the files had spaces you wanted to keep.. do a find with the
-print0 into an xargs with the -0 option that runs the rename.
also bash does slice up strings in variables - see # ## % %% - kind of
a match 'n scratch - good for scripting.
x=Screenshot
echo ${x#Screen}

Ed
[1] http://sourceforge.net/projects/detox/
---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss