Cynosure.X International LLC

: :

Add Comment | Related Links | TrackBack
Related Content

RegExRename.sh (GPL)

RegExRename.sh is a Bourne Shell script that will search for a particular regular expression in a file name and replace it with another string. Because RegExRename.sh is written as a command-line script, it can be used in your own custom scripts.

RegExRename.sh is distributed as executable source code under the GNU General Public License. Please see the license agreement elsewhere on this site.

Usage

RegExRename.sh "srch str" "repl str" "file 1" [ ... "file n" ]

Example 1

Substituting the "dscn" prefix with "pict" in all jpg files:

RegExRename.sh "dscn" "pict" *.jpg

Result:

dscn0038.jpg -> pict0038.jpg
dscn0039.jpg -> pict0039.jpg
dscn0040.jpg -> pict0040.jpg
dscn0041.jpg -> pict0041.jpg
dscn0042.jpg -> pict0042.jpg
dscn0043.jpg -> pict0043.jpg
dscn0044.jpg -> pict0044.jpg
dscn0045.jpg -> pict0045.jpg

Example 2

Changing file name extension from "txt" to "html":

RegExRename.sh "txt" "html" *.txt

Result:

19980206_0042.txt -> 19980206_0042.html
19980206_0856.txt -> 19980206_0856.html
19980225_1257.txt -> 19980225_1257.html
19980225_1343.txt -> 19980225_1343.html
19980310_1245.txt -> 19980310_1245.html
19980330_1401.txt -> 19980330_1401.html
19980330_1437.txt -> 19980330_1437.html
19980330_1456.txt -> 19980330_1456.html
19980330_1637.txt -> 19980330_1637.html

Attached File: RegExRename.sh (748 B)

Chieh Cheng
Fri, 14 Mar 2008 00:15:11 +0000

Add Comment | Related Links | TrackBack
Related Content

Did your message disappear? Read the Forums FAQ.

Add Comment

Spam Control | * indicates required field
Your Name: *
E-mail:
Remember Me!
Comment: *
File attachment is optional. Please do not attach a file to your submission unless it is relevent.
Attach File:
(20 MB Max)
Spam Protection: * Answer of 10 + 3?
Click button only once, please!

TrackBack

TrackBack only accepted from WebSite-X Suite web sites. Do not submit TrackBacks from other sites.

Send Ping | TrackBack URL | Spam Control

No TrackBacks yet. TrackBack can be used to link this thread to your weblog, or link your weblog to this thread. In addition, TrackBack can be used as a form of remote commenting. Rather than posting the comment directly on this thread, you can posts it on your own weblog. Then have your weblog sends a TrackBack ping to the TrackBack URL, so that your post would show up here.

Messages, files, and images copyright by respective owners.

Products | Services
Forums | Latest | RSS
Library | Search | Wiki
Help | Licenses

Login | Register

64 Users Online

Hacking Digital Cameras
Fun for Photographers



Amazon Associate

Copyright © 1996 - 2024. All Rights Reserved.