<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Find and replace text string script in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/find-and-replace-text-string-script/m-p/3012391#M5425</link>
    <description>Typically I use the "tr" command to translate one string to another.Try man tr and use it in your loop for each file to accomplish the task.</description>
    <pubDate>Tue, 01 Jul 2003 18:18:08 GMT</pubDate>
    <dc:creator>Paddy_1</dc:creator>
    <dc:date>2003-07-01T18:18:08Z</dc:date>
    <item>
      <title>Find and replace text string script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/find-and-replace-text-string-script/m-p/3012387#M5421</link>
      <description>Hello All,&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;# find . ???depth ???exec grep ???l ???serverA??? {} \;&lt;BR /&gt;&lt;BR /&gt;Any help would greatly be appreciated.&lt;BR /&gt;</description>
      <pubDate>Tue, 01 Jul 2003 15:17:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/find-and-replace-text-string-script/m-p/3012387#M5421</guid>
      <dc:creator>Lowell Lindeman</dc:creator>
      <dc:date>2003-07-01T15:17:30Z</dc:date>
    </item>
    <item>
      <title>Re: Find and replace text string script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/find-and-replace-text-string-script/m-p/3012388#M5422</link>
      <description>find . -type f -exec perl -pi -e 's/serverA/serverB.domain.com/g' {} \;&lt;BR /&gt;&lt;BR /&gt;All on one line, of course.</description>
      <pubDate>Tue, 01 Jul 2003 15:31:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/find-and-replace-text-string-script/m-p/3012388#M5422</guid>
      <dc:creator>Albert P Tobey</dc:creator>
      <dc:date>2003-07-01T15:31:49Z</dc:date>
    </item>
    <item>
      <title>Re: Find and replace text string script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/find-and-replace-text-string-script/m-p/3012389#M5423</link>
      <description>Thank you for the input. I must be typing this in wrong or something because I receive the following error:&lt;BR /&gt;&lt;BR /&gt;Malformed UTF-8 character (unexpected end of string) at -e line 1, &amp;lt;&amp;gt; line 6917.&lt;BR /&gt;</description>
      <pubDate>Tue, 01 Jul 2003 15:43:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/find-and-replace-text-string-script/m-p/3012389#M5423</guid>
      <dc:creator>Lowell Lindeman</dc:creator>
      <dc:date>2003-07-01T15:43:20Z</dc:date>
    </item>
    <item>
      <title>Re: Find and replace text string script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/find-and-replace-text-string-script/m-p/3012390#M5424</link>
      <description>You could try this, it isn't a one liner, but what the hey.&lt;BR /&gt;&lt;BR /&gt;for i in `find . -depth -exec grep -l 'serverA' {} \; | sed 's/\.\///'`&lt;BR /&gt;do&lt;BR /&gt;sed 's/serverA/serverA.ur.domain/' $i &amp;gt; $i.m&lt;BR /&gt;mv $i.m $i&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 01 Jul 2003 17:09:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/find-and-replace-text-string-script/m-p/3012390#M5424</guid>
      <dc:creator>Robert Salter</dc:creator>
      <dc:date>2003-07-01T17:09:52Z</dc:date>
    </item>
    <item>
      <title>Re: Find and replace text string script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/find-and-replace-text-string-script/m-p/3012391#M5425</link>
      <description>Typically I use the "tr" command to translate one string to another.Try man tr and use it in your loop for each file to accomplish the task.</description>
      <pubDate>Tue, 01 Jul 2003 18:18:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/find-and-replace-text-string-script/m-p/3012391#M5425</guid>
      <dc:creator>Paddy_1</dc:creator>
      <dc:date>2003-07-01T18:18:08Z</dc:date>
    </item>
    <item>
      <title>Re: Find and replace text string script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/find-and-replace-text-string-script/m-p/3012392#M5426</link>
      <description>Try:&lt;BR /&gt;export LC_ALL=C&lt;BR /&gt;find . -type f -exec perl -pi -e 's/serverA/serverB.domain.com/g' {} \;&lt;BR /&gt;&lt;BR /&gt;Or the one-liner:&lt;BR /&gt;LC_ALL=C find . -type f -exec perl -pi -e 's/serverA/serverB.domain.com/g' {} \;&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;</description>
      <pubDate>Tue, 01 Jul 2003 18:26:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/find-and-replace-text-string-script/m-p/3012392#M5426</guid>
      <dc:creator>Albert P Tobey</dc:creator>
      <dc:date>2003-07-01T18:26:59Z</dc:date>
    </item>
  </channel>
</rss>

