Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 254
  • 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

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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