Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Searching and replacing characters -IF THEN - how?

Status
Not open for further replies.

stla

IS-IT--Management
Mar 12, 2003
190
DE
I have several files in various sub directories.

Some of the files and characters have 'illegal' characters ín there names like: % & § $

Can anyone tell me how to search for these files, then execute a follow on command that would move these characters to an underscore _ ?

Do I use FIND IF THEN ?

Best regards
 
man find
man tr
man mv

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thank you.

I have looked at the man pages; I am right in thinking tr pertains to the content of a particular file and not the name, because it's names I need to change?

Can you help me with the following (IRIX):

find . -name %* -exec mv..........
 
A starting point:[tt]
find . -name '*[%&§$]*' -type f | while read f; do mv "$f" `echo "$f" | tr '%&§$' '____'`; done[/tt]


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top