Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 267
  • Last Modified:

Basic Scripting Question !

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
peigster
Asked:
peigster
  • 3
1 Solution
 
ahoffmannCommented:
what exactly is the filename?
  "[01] blah filename.txt"
  [01] blah filename.txt
  blah filename.txt
0
 
ozoCommented:
perl -e'for(@ARGV){($f=$_)=~s/([][\d]*)/$1 ABC -/;rename $_,$f;}' *.txt
0
 
peigsterAuthor Commented:
current filename is
[01] blah filename.txt
i want to rename it to
[01] ABC - blah filename.txt
0
 
peigsterAuthor Commented:
Thanks a million !
0
 
peigsterAuthor Commented:
Thanks a million !
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now