Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Basic Scripting Question !

Posted on 2002-07-08
5
Medium Priority
?
252 Views
Last Modified: 2010-04-21
Hi all,
I want to a script to change file names from following:

/home/ABC
"[01] blah filename.txt"
"[02] blrub filename.txt"
.
.
"[10] blaah filename.txt"

to something like this

/home/ABC
"[01] ABC - blah filename.txt"
"[02] ABC - blrub filename.txt"
.    
.
"[10] ABC - blaah filename.txt"

Also can anyone point me to a site for learning to write basic scripts ?
Thanks !
0
Comment
Question by:peigster
  • 3
5 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 7138681
what exactly is the filename?
  "[01] blah filename.txt"
  [01] blah filename.txt
  blah filename.txt
0
 
LVL 85

Accepted Solution

by:
ozo earned 200 total points
ID: 7139030
perl -e'for(@ARGV){($f=$_)=~s/([][\d]*)/$1 ABC -/;rename $_,$f;}' *.txt
0
 

Author Comment

by:peigster
ID: 7140155
current filename is
[01] blah filename.txt
i want to rename it to
[01] ABC - blah filename.txt
0
 

Author Comment

by:peigster
ID: 7140165
Thanks a million !
0
 

Author Comment

by:peigster
ID: 7140264
Thanks a million !
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Suggested Courses
Course of the Month12 days, 16 hours left to enroll

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question