[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bulk filename changes BASH sed solution...



This is the best way I know of doing it. Not that that necessarily means
much... Anyway, here is the BASH script...

#!/bin/sh
for i in *.jpg.in.out
do
mv "$i" "`echo $i | sed 's/.in.out//'`"
done

Or, you can do that right at the command prompt on one line like so
(given that you are using BASH):

for i in *.jpg.in.out; do mv "$i" "`echo $i | sed 's/.in.out//'`"; done

Good luck...

Ken



On Wed, 2005-01-19 at 17:34 -0600, Jason V Smith wrote:
> Good evening,
> 
> I'm stumped not sure where to look.  Here's what I want to do.  I have a
> bunch of pictures that are named similar to this pb040016.jpg.in.out.
> What I want is to rename the file to this pb040016.jpg.  But I have a
> bunch of files like this.  I know this is probably pretty simple but I'm
> not sure what command(s) could help.  My only stipulation, if at all
> possible, is to not use perl/python/sed or awk.  But feel free to offer
> up perl one-liners that would do this.  It will help further what little
> (I emphasize little) perl knowledge that I have.
> 
> Your help is greatly appreciated.
> 
> Jason


-
To unsubscribe, send email to majordomo@silug.org with
"unsubscribe silug-discuss" in the body.