Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Basic Scripting Question !

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

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

to something like this

"[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 !
Question by:peigster
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
LVL 51

Expert Comment

ID: 7138681
what exactly is the filename?
  "[01] blah filename.txt"
  [01] blah filename.txt
  blah filename.txt
LVL 84

Accepted Solution

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

Author Comment

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

Author Comment

ID: 7140165
Thanks a million !

Author Comment

ID: 7140264
Thanks a million !

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

Question has a verified solution.

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

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…
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses

721 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