Basic Scripting Question !

Posted on 2002-07-08
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 50 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap ( Version 1.2 2.      Jpcap( Version 0.6 Prerequisite: 1.      GCC …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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.

756 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