|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 | ||
|
![]() |
| Thread Tools | Search this Thread |
| 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 |
|
|