?
Solved

Remove character "-" in a selected range of file names within a directory

Posted on 2005-03-10
5
Medium Priority
?
274 Views
Last Modified: 2010-08-05
Is there an easy way to remove the character "-" from the files below using sed other unix command?:

1-58284-000-8.gif
1-58284-001-6.gif
1-58284-002-4.gif
1-58284-003-2.gif
1-86156-313-2.gif
1-86156-383-3.gif

1582840008.gif
1582840016.gif
1582840024.gif
1582840032.gif
1861563132.gif
1861563833.gif

Thanks,

David



0
Comment
Question by:dpaule
[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
5 Comments
 
LVL 48

Accepted Solution

by:
Tintin earned 200 total points
ID: 13513643
for i in *.gif
do
   mv $i `echo $i | sed 's/-//g'`
done
0
 
LVL 38

Expert Comment

by:yuzh
ID: 13514026
You can also use "tr" to do the job:

for i in *.gif
do
   mv $i `echo $i | tr -d "-"`
done
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 13515753
guessing ...
  perl -e'for(@ARGV){($f=$_)=~s(-)()g;print "rename $_,$f";}'
and if that is what you want, then use
  perl -e'for(@ARGV){($f=$_)=~s(-)()g;rename $_,$f;}'
0

Featured Post

Industry Leaders: 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

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…
Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
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…
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…
Suggested Courses
Course of the Month10 days, 23 hours left to enroll

770 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