<?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 Search and replace Text in a File in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/search-and-replace-text-in-a-file/m-p/5136196#M451346</link>
    <description>Hi ,&lt;BR /&gt;&lt;BR /&gt; I want a replace a text &lt;BR /&gt;&lt;BR /&gt;like "/asia/Calcutta"    to  "/india" in a &lt;BR /&gt;&lt;BR /&gt;file using some unix commands  . Any &lt;BR /&gt;&lt;BR /&gt;suggestions would be helpful .&lt;BR /&gt;&lt;BR /&gt;--Rob&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Sun, 19 Oct 2008 11:42:04 GMT</pubDate>
    <dc:creator>Robjan</dc:creator>
    <dc:date>2008-10-19T11:42:04Z</dc:date>
    <item>
      <title>Search and replace Text in a File</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/search-and-replace-text-in-a-file/m-p/5136196#M451346</link>
      <description>Hi ,&lt;BR /&gt;&lt;BR /&gt; I want a replace a text &lt;BR /&gt;&lt;BR /&gt;like "/asia/Calcutta"    to  "/india" in a &lt;BR /&gt;&lt;BR /&gt;file using some unix commands  . Any &lt;BR /&gt;&lt;BR /&gt;suggestions would be helpful .&lt;BR /&gt;&lt;BR /&gt;--Rob&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sun, 19 Oct 2008 11:42:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/search-and-replace-text-in-a-file/m-p/5136196#M451346</guid>
      <dc:creator>Robjan</dc:creator>
      <dc:date>2008-10-19T11:42:04Z</dc:date>
    </item>
    <item>
      <title>Re: Search and replace Text in a File</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/search-and-replace-text-in-a-file/m-p/5136197#M451347</link>
      <description>"man sed"&lt;BR /&gt;&lt;BR /&gt;A Forum search for "sed" should find many&lt;BR /&gt;examples.</description>
      <pubDate>Sun, 19 Oct 2008 12:07:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/search-and-replace-text-in-a-file/m-p/5136197#M451347</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2008-10-19T12:07:59Z</dc:date>
    </item>
    <item>
      <title>Re: Search and replace Text in a File</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/search-and-replace-text-in-a-file/m-p/5136198#M451348</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;sed 's/\/asia\/Calcutta/\/India/g' &lt;FILENAME&gt;&lt;BR /&gt;&lt;BR /&gt;would be one approach.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Ninad&lt;/FILENAME&gt;</description>
      <pubDate>Sun, 19 Oct 2008 12:25:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/search-and-replace-text-in-a-file/m-p/5136198#M451348</guid>
      <dc:creator>Ninad_1</dc:creator>
      <dc:date>2008-10-19T12:25:22Z</dc:date>
    </item>
    <item>
      <title>Re: Search and replace Text in a File</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/search-and-replace-text-in-a-file/m-p/5136199#M451349</link>
      <description>sed can be quite intimidating to use, especially if you aren't familiar with vi. The attached script chgafile will replace one string with another. The default is to show before and after lines (with the string highlighted) but make no changes. Run it with no options to see all the options documented.</description>
      <pubDate>Sun, 19 Oct 2008 23:01:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/search-and-replace-text-in-a-file/m-p/5136199#M451349</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2008-10-19T23:01:10Z</dc:date>
    </item>
    <item>
      <title>Re: Search and replace Text in a File</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/search-and-replace-text-in-a-file/m-p/5136200#M451350</link>
      <description>You can use ! instead of slashes to avoid&lt;BR /&gt;having to quote directory slashes&lt;BR /&gt;&lt;BR /&gt;sed 's!/asia/Calcutta/!/India/g' &lt;FILENAME&gt;&lt;BR /&gt;&lt;BR /&gt;also you can put the various sed commands&lt;BR /&gt;in a seperate text file&lt;BR /&gt;&lt;BR /&gt;'s!/asia/Calcutta/!/India/g'&lt;BR /&gt;'s!/asia/Bomnay/!/India/g'&lt;BR /&gt;'s!/asia/Delhi/!/India/g'&lt;BR /&gt;&lt;BR /&gt;sed -f script_file &lt;DATAFILE&gt;&lt;BR /&gt;&lt;BR /&gt;-f script_file Take script from file script_file.&lt;BR /&gt;&lt;/DATAFILE&gt;&lt;/FILENAME&gt;</description>
      <pubDate>Mon, 20 Oct 2008 07:57:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/search-and-replace-text-in-a-file/m-p/5136200#M451350</guid>
      <dc:creator>Frank de Vries</dc:creator>
      <dc:date>2008-10-20T07:57:05Z</dc:date>
    </item>
    <item>
      <title>Re: Search and replace Text in a File</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/search-and-replace-text-in-a-file/m-p/5136201#M451351</link>
      <description>u can use vi editor for this&lt;BR /&gt;&lt;BR /&gt;vi file name&lt;BR /&gt;in cmd mode&lt;BR /&gt;&lt;BR /&gt;If you want to replace asia only&lt;BR /&gt;:%s/asia/india/g &lt;BR /&gt;In case you want to replace /asia/Calcutta with /india then use &lt;BR /&gt;:%s/asia\/Calcutta/india/g</description>
      <pubDate>Mon, 20 Oct 2008 08:33:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/search-and-replace-text-in-a-file/m-p/5136201#M451351</guid>
      <dc:creator>AwadheshPandey</dc:creator>
      <dc:date>2008-10-20T08:33:12Z</dc:date>
    </item>
    <item>
      <title>Re: Search and replace Text in a File</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/search-and-replace-text-in-a-file/m-p/5136202#M451352</link>
      <description>Hi,&lt;BR /&gt;All the suggestion posted by you doesnt help . For everything I am getting line cannot be parsed message . &lt;BR /&gt;if there is any other way please help me out .&lt;BR /&gt;--Rob</description>
      <pubDate>Mon, 20 Oct 2008 12:06:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/search-and-replace-text-in-a-file/m-p/5136202#M451352</guid>
      <dc:creator>Robjan</dc:creator>
      <dc:date>2008-10-20T12:06:31Z</dc:date>
    </item>
    <item>
      <title>Re: Search and replace Text in a File</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/search-and-replace-text-in-a-file/m-p/5136203#M451353</link>
      <description>&amp;gt; All the suggestion posted by you doesnt&lt;BR /&gt;&amp;gt; help .&lt;BR /&gt;&lt;BR /&gt;You're not helping us much, either.&lt;BR /&gt;&lt;BR /&gt;&amp;gt; For everything I am getting line cannot be&lt;BR /&gt;&amp;gt; parsed message . &lt;BR /&gt;&lt;BR /&gt;"Everything" covers a big region.  Perhaps if&lt;BR /&gt;we were psychic, or if you showed your actual&lt;BR /&gt;commands with their actual results, we might&lt;BR /&gt;be able to guess what you did wrong.&lt;BR /&gt;&lt;BR /&gt;"Doesn't work" is not a useful problem&lt;BR /&gt;description.</description>
      <pubDate>Mon, 20 Oct 2008 12:28:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/search-and-replace-text-in-a-file/m-p/5136203#M451353</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2008-10-20T12:28:24Z</dc:date>
    </item>
    <item>
      <title>Re: Search and replace Text in a File</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/search-and-replace-text-in-a-file/m-p/5136204#M451354</link>
      <description>"..All the suggestion posted by you doesnt help . For everything I am getting line cannot be parsed message.."&lt;BR /&gt;&lt;BR /&gt;Hmm...seems to work for me (which is what I expected).  As Frank noted, its easiest to avoid using a character appearing in the text as the "commmand delimter".  Doing so means you don't have to go thru the tedious and error-prone step of "escaping" the delimiter.  Thus:&lt;BR /&gt;&lt;BR /&gt;fcat#: pg fsm&lt;BR /&gt;/asia/calcutta&lt;BR /&gt;/asia/bombay&lt;BR /&gt;fcat#:&lt;BR /&gt;fcat#: sed -e 's!/asia/calcutta!/india/!g' fsm&lt;BR /&gt;/india/&lt;BR /&gt;/asia/bombay&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Note: having to "escape" the delimiter can be a royal pain....and you tend to see "cannot be parsed" errors.  Too many things influence what is the "correct" number of "escapes", like "is this run from a command line" or "is this in a shell script" or others.&lt;BR /&gt;</description>
      <pubDate>Mon, 20 Oct 2008 12:53:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/search-and-replace-text-in-a-file/m-p/5136204#M451354</guid>
      <dc:creator>OldSchool</dc:creator>
      <dc:date>2008-10-20T12:53:27Z</dc:date>
    </item>
    <item>
      <title>Re: Search and replace Text in a File</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/search-and-replace-text-in-a-file/m-p/5136205#M451355</link>
      <description>My problem is resolved . &lt;BR /&gt;Thanks for all your suggestions&lt;BR /&gt;</description>
      <pubDate>Mon, 20 Oct 2008 13:03:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/search-and-replace-text-in-a-file/m-p/5136205#M451355</guid>
      <dc:creator>Robjan</dc:creator>
      <dc:date>2008-10-20T13:03:14Z</dc:date>
    </item>
  </channel>
</rss>

