![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | 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. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Counting the number of occurances of all characters (a-z) in a string | rsendhilmani | Shell Programming and Scripting | 5 | 08-05-2008 12:10 PM |
| Replace spaces recursively | prvnrk | Shell Programming and Scripting | 5 | 08-31-2007 04:37 AM |
| How to replace the string in unix file? | param_it | UNIX for Dummies Questions & Answers | 5 | 06-26-2007 09:06 AM |
| replace a string with content from another file | afatguy | Shell Programming and Scripting | 4 | 09-14-2006 09:25 PM |
| replace a string in a file | ratan2204 | Shell Programming and Scripting | 7 | 05-10-2006 09:40 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread |
Rating:
|
Display Modes |
|
|
|
||||
|
I need a script that will replace all occurances of a string in all filenames and foldernames, recursively.
Right now I have this script: Code:
for f in `find -name *eye*`; do echo processing $f g=`expr "xxx$f" : 'xxx\(.*\)' | tr 'eye' 'm'` mv "$f" "$g" done I adapted this from http://webxadmin.free.fr/article/she...o-lowe-135.php so I don't really know what the regular expressions in expr are doing. It is aggravating because I am so close, but I can't get it to work. Last edited by TheMJ; 04-12-2006 at 01:40 AM.. Reason: added SOLVED to title |
|
||||
|
I had problems getting your script to work but here is one that does:
Code:
for f in `find . -name \*eye\* -print`; do echo processing $f g=`print "$f" | nawk 'gsub(/eye/,"m")'` mv "$f" "$g" done |
![]() |
| Bookmarks |
| Tags |
| regex, regular expressions |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|