Find and Rename files using (find mv and sed) | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Find and Rename files using (find mv and sed)

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 10-12-2010
rupert160 rupert160 is offline
Registered User
 
Join Date: Oct 2010
Last Activity: 18 November 2010, 9:20 PM EST
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Find and Rename files using (find mv and sed)

In response to a closed thread for degraff63 at
http://www.unix.com/shell-programmin...find-exec.html

the following command
might do it as some shells spit it without the "exec bash -c " part:

Code:
Find . -name "*.model" -exec bash -c "mv {} \`echo {} | sed -e  's/[^A-Za-z0-9_./]/_/g'\`" \;



the earlier command he wrote was.

Code:
Find . -name "*.model" -exec mv "{}" `echo "{}" | sed 's/[^A-Za-z0-9_./]/_/g'` \;





Last edited by jim mcnamara; 10-13-2010 at 03:45 AM.. Reason: url tags
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Find last updated files and rename ramse8pc Shell Programming and Scripting 3 05-17-2010 10:47 PM
Find and rename Legend986 Shell Programming and Scripting 2 09-29-2008 03:19 AM
Little bit weired : Find files in UNIX w/o using find or where command jatin.jain Shell Programming and Scripting 10 09-19-2007 06:47 AM
Find, Append, Move & Rename Multiple Files Trapper Shell Programming and Scripting 5 08-30-2007 07:39 AM
Find and rename all folders with name X. mkingrey UNIX for Dummies Questions & Answers 6 06-06-2007 04:49 PM



All times are GMT -4. The time now is 03:49 PM.