![]() |
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 |
| help with a 'while read' loop to change the names of files | starsky | Shell Programming and Scripting | 6 | 03-01-2008 01:47 PM |
| Change All File Names in a Directory | andou | UNIX for Dummies Questions & Answers | 8 | 01-22-2008 09:06 PM |
| Reading file names from a file and executing the relative file from shell script | anushilrai | Shell Programming and Scripting | 4 | 03-10-2006 05:25 AM |
| Script to automatically change password. | rahulrathod | Shell Programming and Scripting | 1 | 10-04-2004 08:33 AM |
| How would I telnet & change user password automatically in a script | darthur | UNIX for Dummies Questions & Answers | 4 | 01-14-2002 11:40 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
How to change automatically the file names
Hi all,
I need to replace automatically all special characters of one filename with some corresponding characters For example > ö --> oe ä --> ae .... If the special character comes more than one time, then all the coccuerences have to be replaced. I would like to have a acript, which could do the replacement through the whole file system. Can somebody help me please Thanks in advance MAKY |
|
||||
|
Vino, thanks for the quick reply, but I couldn't get any result yet.
I have written your script in the following form, making the test for replacing all the z letters with d letters #! /bin/sh for file in `find /tmp/ -name '*.*'` do PATH=${file%/*} FILE_OLD=${file#$PATH} FILE_NEW={FILE_OLD//<z>/<d>} mv ${PATH}/${file} ${PATH}/${FILE_NEW} done The script doesn't give any error but also doesn't replace any charecters. Thanks in advance MAKY |
|
|||||
|
Code:
#! /bin/sh
for file in `find /tmp/ -name '*.*'`
do
PATH=${file%/*}
FILE_OLD=${file#$PATH}
FILE_NEW=${FILE_OLD//z/d}
mv ${PATH}/${file} ${PATH}/${FILE_NEW}
done
vino Last edited by vino; 08-10-2005 at 09:31 AM.. Reason: Missed the $ |
|
|||||
|
Code:
#! /bin/sh
for file in `find /tmp/ -name '*.*'`
do
PATH=${file%/*}
FILE_OLD=${file#$PATH/}
FILE_NEW=${FILE_OLD//z/d}
mv ${file} ${PATH}/${FILE_NEW}
done
Last edited by vino; 08-10-2005 at 10:52 AM.. Reason: input for mv was wrong |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|