[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ale] help with batch file renaming
- Subject: [ale] help with batch file renaming
- From: dsj at sylvester.dsj.net (David S. Jackson)
- Date: Sun, 3 Aug 2003 11:41:19 -0400
On Sat, Aug 02, 2003 at 11:17:12PM -0400 Jim Seymour <bluejay at speedfactory.net> wrote:
> I have a number of image files I need to rename. Example:
>
> 2003_Billy_Bob_01.jpg
> 2003_Billy_Bob_02.jpg
>
> to
>
> 2003_Billy_Jo_Bob_01.jpg
> 2003_Billy_Jo_Bob_02.jpg
>
> There may be 50 or more files I need to rename at a time. I have been
> playing with rename to no avail. Anyone know a bash script or something
> to make my life easier?
Try this:
for f in *; do mv $f ${f%%_*}_Jo_${f#*_}; done
--
David S. Jackson dsj at dsj.net
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
I put contact lenses in my dog's eyes. They had
little pictures of cats on them. Then I took one
out and he ran around in circles.
-- Steven Wright
_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale