Solved

Basic Scripting Question !

Posted on 2002-07-08
5
208 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
Comment Utility
what exactly is the filename?
  "[01] blah filename.txt"
  [01] blah filename.txt
  blah filename.txt
0
 
LVL 84

Accepted Solution

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

Author Comment

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

Author Comment

by:peigster
Comment Utility
Thanks a million !
0
 

Author Comment

by:peigster
Comment Utility
Thanks a million !
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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 …
When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
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.

743 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now