- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: Find and replace text string script
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2003 08:17 AM
07-01-2003 08:17 AM
I could really use some help with a task I have been working on. I'm in the process of moving an application from one server to another. Part of this process involves me searching a directory and all sub-directories below it for text files containing the old server name and replacing that with a fully qualified DNS name.
I have been searching and reading MAN pages for a day now but have not been able to gain any ground. I have come up with a command to find all the files that need to be changed but I???m at a loss for the command to replace the text string.
# find . ???depth ???exec grep ???l ???serverA??? {} \;
Any help would greatly be appreciated.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2003 08:31 AM
07-01-2003 08:31 AM
Re: Find and replace text string script
All on one line, of course.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2003 08:43 AM
07-01-2003 08:43 AM
Re: Find and replace text string script
Malformed UTF-8 character (unexpected end of string) at -e line 1, <> line 6917.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2003 10:09 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2003 11:18 AM
07-01-2003 11:18 AM
Re: Find and replace text string script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2003 11:26 AM
07-01-2003 11:26 AM
Re: Find and replace text string script
export LC_ALL=C
find . -type f -exec perl -pi -e 's/serverA/serverB.domain.com/g' {} \;
Or the one-liner:
LC_ALL=C find . -type f -exec perl -pi -e 's/serverA/serverB.domain.com/g' {} \;
I'm guessing you're running a very new linux distribution like RH9 or Mandrake 9 - they have unicode supported in everything possible, including perl and the shell utils. This causes trouble with a bunch of stuff like this. Hint: running acrobat on RH9 works with the LC_ALL=C trick, too.