Link to home
Start Free TrialLog in
Avatar of dpaule
dpaule

asked on

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

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



ASKER CERTIFIED SOLUTION
Avatar of Tintin
Tintin

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of yuzh
yuzh

You can also use "tr" to do the job:

for i in *.gif
do
   mv $i `echo $i | tr -d "-"`
done
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;}'