<?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: Changing a paragraph within a text file in Operating System - Microsoft</title>
    <link>https://community.hpe.com/t5/operating-system-microsoft/changing-a-paragraph-within-a-text-file/m-p/4859749#M10167</link>
    <description>Right now i have done this do replace only the db_name, if u need for hostname &amp;amp; port u have to modify the code for the same..&lt;BR /&gt;&lt;BR /&gt;i think u should be able to do it.. if not let me know, i will do it for u..&lt;BR /&gt;&lt;BR /&gt;Ganesh</description>
    <pubDate>Tue, 07 Sep 2004 15:29:00 GMT</pubDate>
    <dc:creator>Ganesh Babu</dc:creator>
    <dc:date>2004-09-07T15:29:00Z</dc:date>
    <item>
      <title>Changing a paragraph within a text file</title>
      <link>https://community.hpe.com/t5/operating-system-microsoft/changing-a-paragraph-within-a-text-file/m-p/4859746#M10164</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;I need to make a change to a config file on each client Windows PC.&lt;BR /&gt;Ideally, I would like to create a batch script that I could mail to users and they could run themselves to make the change.&lt;BR /&gt;&lt;BR /&gt;The layout of the file is as follows:&lt;BR /&gt;&lt;BR /&gt;&lt;DB_NAME&gt;.WORLD =&lt;BR /&gt;  (DESCRIPTION =&lt;BR /&gt;    (ADDRESS = (PROTOCOL = TCP)(HOST = &lt;HOSTNAME&gt;)(PORT = &lt;PORT&gt;))&lt;BR /&gt;    (CONNECT_DATA = (SID = &lt;DB_NAME&gt;))&lt;BR /&gt;  )&lt;BR /&gt;&lt;BR /&gt;The file may have 10 or 15 of these paragraphs, including other entries with the same hostnames and port numbers but the db_name in each paragraph is unique.&lt;BR /&gt;&lt;BR /&gt;If &lt;DB_NAME&gt; is equal to ABCD, then I want to change &lt;HOSTNAME&gt; to XYZ and &lt;PORT&gt; to 1234.&lt;BR /&gt;&lt;BR /&gt;Does anyone have any ideas on this?&lt;BR /&gt;&lt;BR /&gt;Any Help Appreciated&lt;BR /&gt;&lt;BR /&gt;Michael&lt;/PORT&gt;&lt;/HOSTNAME&gt;&lt;/DB_NAME&gt;&lt;/DB_NAME&gt;&lt;/PORT&gt;&lt;/HOSTNAME&gt;&lt;/DB_NAME&gt;</description>
      <pubDate>Tue, 07 Sep 2004 05:08:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-microsoft/changing-a-paragraph-within-a-text-file/m-p/4859746#M10164</guid>
      <dc:creator>Michael Campbell</dc:creator>
      <dc:date>2004-09-07T05:08:59Z</dc:date>
    </item>
    <item>
      <title>Re: Changing a paragraph within a text file</title>
      <link>https://community.hpe.com/t5/operating-system-microsoft/changing-a-paragraph-within-a-text-file/m-p/4859747#M10165</link>
      <description>Hi Michael,&lt;BR /&gt;  I am attaching a windows script file which u can test it out whether it meets your expectations.. &lt;BR /&gt;&lt;BR /&gt;I have hardcoded currently come of the values.. like file name &amp;amp; path and the word to search and replace for..&lt;BR /&gt;&lt;BR /&gt;Ganesh</description>
      <pubDate>Tue, 07 Sep 2004 15:24:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-microsoft/changing-a-paragraph-within-a-text-file/m-p/4859747#M10165</guid>
      <dc:creator>Ganesh Babu</dc:creator>
      <dc:date>2004-09-07T15:24:26Z</dc:date>
    </item>
    <item>
      <title>Re: Changing a paragraph within a text file</title>
      <link>https://community.hpe.com/t5/operating-system-microsoft/changing-a-paragraph-within-a-text-file/m-p/4859748#M10166</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;If u r not able to download the file i am pasting the code here. In brief, what i am doing is, reading the file line by line and checking whether the DBname is there r not, if it is there replace with the new dbname and write to a new file&lt;BR /&gt;  once all lines are over, i am copying the new file to the old filename and then deleteing then delete the new file.&lt;BR /&gt;&lt;BR /&gt;  U can alter the code if u want.. as i told earlier i have some values hardcoded, u can see them in teh code..&lt;BR /&gt;&lt;BR /&gt;Ganesh&lt;BR /&gt;&lt;BR /&gt;&lt;JOB debug="true"&gt;&lt;BR /&gt;&amp;lt;script language="VBScript"&amp;gt;&lt;BR /&gt;&lt;BR /&gt;dim FSO&lt;BR /&gt;dim logfile, newfile&lt;BR /&gt;&lt;BR /&gt;Set FSO = CreateObject("Scripting.FileSystemObject")&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;dim logfilename&lt;BR /&gt;&lt;BR /&gt;logfilename = "e:\testing\1.txt"&lt;BR /&gt;newfilename = "e:\testing\2.txt"&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Set logFile = fso.OpenTextFile(logfilename, 1, False)&lt;BR /&gt;Set newFile = fso.createtextfile(newfilename, True)&lt;BR /&gt;&lt;BR /&gt;dim Rec,result&lt;BR /&gt;&lt;BR /&gt;Do While logFile.AtEndOfStream &amp;lt;&amp;gt; True&lt;BR /&gt;&lt;BR /&gt; Rec = logFile.ReadLine&lt;BR /&gt;&lt;BR /&gt;if instr(Rec,"ABCD") &amp;lt;&amp;gt; 0 then&lt;BR /&gt;&lt;BR /&gt; result = replace (Rec,"ABCD","XYZ")&lt;BR /&gt; newfile.writeline (Result)&lt;BR /&gt;else&lt;BR /&gt;&lt;BR /&gt; newfile.writeline (Rec)&lt;BR /&gt;end if&lt;BR /&gt;&lt;BR /&gt;loop&lt;BR /&gt;&lt;BR /&gt;logfile.close&lt;BR /&gt;newfile.close&lt;BR /&gt;&lt;BR /&gt;set logfile = nothing&lt;BR /&gt;set newfile = nothing&lt;BR /&gt;&lt;BR /&gt;fso.copyfile newfilename,logfilename&lt;BR /&gt;fso.deletefile newfilename&lt;BR /&gt;&lt;BR /&gt;&amp;lt;/script&amp;gt;&lt;BR /&gt;&lt;/JOB&gt;</description>
      <pubDate>Tue, 07 Sep 2004 15:27:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-microsoft/changing-a-paragraph-within-a-text-file/m-p/4859748#M10166</guid>
      <dc:creator>Ganesh Babu</dc:creator>
      <dc:date>2004-09-07T15:27:35Z</dc:date>
    </item>
    <item>
      <title>Re: Changing a paragraph within a text file</title>
      <link>https://community.hpe.com/t5/operating-system-microsoft/changing-a-paragraph-within-a-text-file/m-p/4859749#M10167</link>
      <description>Right now i have done this do replace only the db_name, if u need for hostname &amp;amp; port u have to modify the code for the same..&lt;BR /&gt;&lt;BR /&gt;i think u should be able to do it.. if not let me know, i will do it for u..&lt;BR /&gt;&lt;BR /&gt;Ganesh</description>
      <pubDate>Tue, 07 Sep 2004 15:29:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-microsoft/changing-a-paragraph-within-a-text-file/m-p/4859749#M10167</guid>
      <dc:creator>Ganesh Babu</dc:creator>
      <dc:date>2004-09-07T15:29:00Z</dc:date>
    </item>
    <item>
      <title>Re: Changing a paragraph within a text file</title>
      <link>https://community.hpe.com/t5/operating-system-microsoft/changing-a-paragraph-within-a-text-file/m-p/4859750#M10168</link>
      <description>Thanks Ganesh</description>
      <pubDate>Wed, 08 Sep 2004 02:37:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-microsoft/changing-a-paragraph-within-a-text-file/m-p/4859750#M10168</guid>
      <dc:creator>Michael Campbell</dc:creator>
      <dc:date>2004-09-08T02:37:23Z</dc:date>
    </item>
  </channel>
</rss>

