[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

mv multiple files w/wildcard



I have a number of subdirectories where I have files with - such as 
name - title.txt and I wish to convert them to:
name: title.txt

In bash I tried:

for i in *-*;do mv $i `echo $i | sed -e 's/ - /:/'`'done 

but this gives me an error about moving multiple files and needing a directory


I also tried on e-line perl script

perl -we '($new=$_) =~tr/\s-\s/:\s/ && rename _$,$new'

but I get uninitialized value errors.  Any help on either of these methods to 
rename files would be appreciated. Also, how would I use these for multiple subdirectories at once?

Thanks in advance. 

-- 

                                Lance Hoffmeyer
                                 lanceh@ibm.net

-------------------------------------------------------------------------------
          ...I see in the near future a crisis emerging that unnerves
           me and causes me to tremble for the safety of my country.
         As result of the war, corporations have been enthroned and an
          era of corruption in high places will follow, and the money
       power of the country will endeavor to prolong its reign by working
       upon the prejudices of the people until all wealth is aggregated
                in a few hands, and the Republic is destroyed."
                             ABRAHAM LINCOLN (1864)



Reply to: