<?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: replace characters in a file in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/replace-characters-in-a-file/m-p/3818415#M269577</link>
    <description>Hi All&lt;BR /&gt;&lt;BR /&gt;Thanks for your answer. Sorry. I didn't make it clear. &lt;BR /&gt;&lt;BR /&gt;aaa bbb ccc ddd eee fff represent strings.&lt;BR /&gt;and delemited with :  just like passwd file.&lt;BR /&gt;I want to replace the 3rd field with "---"&lt;BR /&gt;&lt;BR /&gt;Kindly provide the solution&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Sajeesh&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Fri, 07 Jul 2006 01:56:49 GMT</pubDate>
    <dc:creator>Sajeesh O.K</dc:creator>
    <dc:date>2006-07-07T01:56:49Z</dc:date>
    <item>
      <title>replace characters in a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/replace-characters-in-a-file/m-p/3818404#M269566</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;Anybody know how to replace a charater string with a different string from a file having 1000 lines.The file is like this &lt;BR /&gt;&lt;BR /&gt;aaaa:bbbb:cccc:dddd:eeee:ffff:gggg:&lt;BR /&gt;&lt;BR /&gt;I want to replace cccc with xxxxx in all lines&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Sajeesh&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 06 Jul 2006 04:49:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/replace-characters-in-a-file/m-p/3818404#M269566</guid>
      <dc:creator>Sajeesh O.K</dc:creator>
      <dc:date>2006-07-06T04:49:47Z</dc:date>
    </item>
    <item>
      <title>Re: replace characters in a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/replace-characters-in-a-file/m-p/3818405#M269567</link>
      <description># perl -pi -e's/cccc/xxxxx/' file&lt;BR /&gt;&lt;BR /&gt;or more safe, if cccc can occur in a word like ddccccee&lt;BR /&gt;&lt;BR /&gt;# perl -pi -e's/\bcccc\b/xxxxx/' file&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn&lt;BR /&gt;</description>
      <pubDate>Thu, 06 Jul 2006 04:54:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/replace-characters-in-a-file/m-p/3818405#M269567</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2006-07-06T04:54:39Z</dc:date>
    </item>
    <item>
      <title>Re: replace characters in a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/replace-characters-in-a-file/m-p/3818406#M269568</link>
      <description>HI, &lt;BR /&gt;&lt;BR /&gt;You can use sed. &lt;BR /&gt;&lt;BR /&gt;# sed 's/cccc/xxxxx/g' file &lt;BR /&gt;&lt;BR /&gt;-Arun</description>
      <pubDate>Thu, 06 Jul 2006 04:59:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/replace-characters-in-a-file/m-p/3818406#M269568</guid>
      <dc:creator>Arunvijai_4</dc:creator>
      <dc:date>2006-07-06T04:59:15Z</dc:date>
    </item>
    <item>
      <title>Re: replace characters in a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/replace-characters-in-a-file/m-p/3818407#M269569</link>
      <description>Sajeesh,&lt;BR /&gt;&lt;BR /&gt;'tr' also works:&lt;BR /&gt;&lt;BR /&gt;tr 'cccc' 'xxxx' &lt;FILE&gt;&lt;/FILE&gt;&lt;BR /&gt;PCS</description>
      <pubDate>Thu, 06 Jul 2006 06:11:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/replace-characters-in-a-file/m-p/3818407#M269569</guid>
      <dc:creator>spex</dc:creator>
      <dc:date>2006-07-06T06:11:53Z</dc:date>
    </item>
    <item>
      <title>Re: replace characters in a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/replace-characters-in-a-file/m-p/3818408#M269570</link>
      <description>no, tr works on a character by character basis.&lt;BR /&gt;what you wrote here is essentially the same as&lt;BR /&gt;&lt;BR /&gt;tr c x &lt;FILE&gt;new_file&lt;BR /&gt;&lt;BR /&gt;and will change *every* occurance of 'c' to 'x' in file in every line. That's not what he wants&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn&lt;/FILE&gt;</description>
      <pubDate>Thu, 06 Jul 2006 06:14:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/replace-characters-in-a-file/m-p/3818408#M269570</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2006-07-06T06:14:22Z</dc:date>
    </item>
    <item>
      <title>Re: replace characters in a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/replace-characters-in-a-file/m-p/3818409#M269571</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;#cat file|sed 's/cccc/xxxxx/g' &amp;gt; newfile&lt;BR /&gt;&lt;BR /&gt;Rgds.</description>
      <pubDate>Thu, 06 Jul 2006 06:43:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/replace-characters-in-a-file/m-p/3818409#M269571</guid>
      <dc:creator>Jose Mosquera</dc:creator>
      <dc:date>2006-07-06T06:43:09Z</dc:date>
    </item>
    <item>
      <title>Re: replace characters in a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/replace-characters-in-a-file/m-p/3818410#M269572</link>
      <description>Oops.  Good catch, procura.  My apologies.</description>
      <pubDate>Thu, 06 Jul 2006 06:48:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/replace-characters-in-a-file/m-p/3818410#M269572</guid>
      <dc:creator>spex</dc:creator>
      <dc:date>2006-07-06T06:48:03Z</dc:date>
    </item>
    <item>
      <title>Re: replace characters in a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/replace-characters-in-a-file/m-p/3818411#M269573</link>
      <description>Jose, that's the same answer that Arunvijai gave, and even worse, you promote this awful unneeded use of cat&lt;BR /&gt;&lt;BR /&gt;# cat file | process&lt;BR /&gt;&lt;BR /&gt;should be prevented wherever possible. It's just a useless extra load on the CPU, as processes are started that are not needed in a sane unix environment, where&lt;BR /&gt;&lt;BR /&gt;# process &amp;lt; file&lt;BR /&gt;&lt;BR /&gt;does exactly the same, but uses one less process. Cat can be useful if *more* input files create the input stream for process, as input redirection does not support that&lt;BR /&gt;&lt;BR /&gt;# cat file1 file2 | process&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have (efficient) FUN! H.Merijn</description>
      <pubDate>Thu, 06 Jul 2006 06:49:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/replace-characters-in-a-file/m-p/3818411#M269573</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2006-07-06T06:49:04Z</dc:date>
    </item>
    <item>
      <title>Re: replace characters in a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/replace-characters-in-a-file/m-p/3818412#M269574</link>
      <description>&lt;!--!*#--&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;lets play 'sed' a little...&lt;BR /&gt;I think your field delimiter is ':' - this fact was not used in the sed-solutions so far.&lt;BR /&gt;&lt;BR /&gt;from=cccc&lt;BR /&gt;to=xxxx&lt;BR /&gt;sed -e "s/^$from:/$to:/" -e "s/:$from/:$to/g" input &amp;gt;output&lt;BR /&gt;&lt;BR /&gt;But as you see from the previous responses: there is more than one way ...&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Thu, 06 Jul 2006 07:54:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/replace-characters-in-a-file/m-p/3818412#M269574</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2006-07-06T07:54:50Z</dc:date>
    </item>
    <item>
      <title>Re: replace characters in a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/replace-characters-in-a-file/m-p/3818413#M269575</link>
      <description>Please excuse me, especially the partner Pharaoh, and omit this answer.  &lt;BR /&gt;  &lt;BR /&gt;About the sharp comment of the Mr. Procura, there are not words...&lt;BR /&gt;&lt;BR /&gt;Rgds.</description>
      <pubDate>Thu, 06 Jul 2006 07:58:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/replace-characters-in-a-file/m-p/3818413#M269575</guid>
      <dc:creator>Jose Mosquera</dc:creator>
      <dc:date>2006-07-06T07:58:32Z</dc:date>
    </item>
    <item>
      <title>Re: replace characters in a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/replace-characters-in-a-file/m-p/3818414#M269576</link>
      <description>Jose, sorry if I sounded harsh, and it is nothing personal, but somehow the useless use of cat always triggers this reaction with me.&lt;BR /&gt;Again, nothing personal, but yet another good oportunity to set things straight!&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn [ no points here please ]</description>
      <pubDate>Thu, 06 Jul 2006 08:16:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/replace-characters-in-a-file/m-p/3818414#M269576</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2006-07-06T08:16:13Z</dc:date>
    </item>
    <item>
      <title>Re: replace characters in a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/replace-characters-in-a-file/m-p/3818415#M269577</link>
      <description>Hi All&lt;BR /&gt;&lt;BR /&gt;Thanks for your answer. Sorry. I didn't make it clear. &lt;BR /&gt;&lt;BR /&gt;aaa bbb ccc ddd eee fff represent strings.&lt;BR /&gt;and delemited with :  just like passwd file.&lt;BR /&gt;I want to replace the 3rd field with "---"&lt;BR /&gt;&lt;BR /&gt;Kindly provide the solution&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Sajeesh&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 07 Jul 2006 01:56:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/replace-characters-in-a-file/m-p/3818415#M269577</guid>
      <dc:creator>Sajeesh O.K</dc:creator>
      <dc:date>2006-07-07T01:56:49Z</dc:date>
    </item>
    <item>
      <title>Re: replace characters in a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/replace-characters-in-a-file/m-p/3818416#M269578</link>
      <description>for example the filename is 111 and turn it to file 222&lt;BR /&gt;#from=ccc&lt;BR /&gt;#to=---&lt;BR /&gt;#sed -e "s/$from/$to/" -e "s/$from/$to/g" 111 &amp;gt; 222  &lt;BR /&gt;&lt;BR /&gt;--Z.X.</description>
      <pubDate>Fri, 07 Jul 2006 02:25:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/replace-characters-in-a-file/m-p/3818416#M269578</guid>
      <dc:creator>Junghun</dc:creator>
      <dc:date>2006-07-07T02:25:13Z</dc:date>
    </item>
    <item>
      <title>Re: replace characters in a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/replace-characters-in-a-file/m-p/3818417#M269579</link>
      <description>&amp;gt; aaa bbb ccc ddd eee fff represent strings.&lt;BR /&gt;&amp;gt; and delemited with : just like passwd file.&lt;BR /&gt;&amp;gt; I want to replace the 3rd field with "---"&lt;BR /&gt;&lt;BR /&gt;# perl -pi -aF: -e'$F[2]="---";$_=join":",@F' file&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
      <pubDate>Fri, 07 Jul 2006 02:28:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/replace-characters-in-a-file/m-p/3818417#M269579</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2006-07-07T02:28:31Z</dc:date>
    </item>
    <item>
      <title>Re: replace characters in a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/replace-characters-in-a-file/m-p/3818418#M269580</link>
      <description>procura&lt;BR /&gt;&lt;BR /&gt;Perfect. Thanks for the promt reply&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Sajeesh&lt;BR /&gt;</description>
      <pubDate>Fri, 07 Jul 2006 02:37:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/replace-characters-in-a-file/m-p/3818418#M269580</guid>
      <dc:creator>Sajeesh O.K</dc:creator>
      <dc:date>2006-07-07T02:37:35Z</dc:date>
    </item>
    <item>
      <title>Re: replace characters in a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/replace-characters-in-a-file/m-p/3818419#M269581</link>
      <description>&lt;!--!*#--&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;to complete the thread, here a solution with awk:&lt;BR /&gt;&lt;BR /&gt;awk -F: '$3 == "ccccc" {$3="-----"}&lt;BR /&gt;{print}' input &amp;gt;output&lt;BR /&gt;&lt;BR /&gt;Or sed?&lt;BR /&gt;&lt;BR /&gt;sed 's/^\([^:]*:[^:]*:\)'$from'\(.*\)/\1'$to'\2/'  input &amp;gt;output&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Fri, 07 Jul 2006 06:14:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/replace-characters-in-a-file/m-p/3818419#M269581</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2006-07-07T06:14:33Z</dc:date>
    </item>
  </channel>
</rss>

