Solved

Basic Scripting Question !

Posted on 2002-07-08
5
242 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
[X]
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
5 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 7138681
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
ID: 7139030
perl -e'for(@ARGV){($f=$_)=~s/([][\d]*)/$1 ABC -/;rename $_,$f;}' *.txt
0
 

Author Comment

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

Author Comment

by:peigster
ID: 7140165
Thanks a million !
0
 

Author Comment

by:peigster
ID: 7140264
Thanks a million !
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
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.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

615 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