<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.technet.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>How Can I Insert Text Into a Specific Column of a Text File?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2006/06/15/how-can-i-insert-text-into-a-specific-column-of-a-text-file.aspx</link><description>Hey, Scripting Guy! How can I insert text into a specific column of a text file? I don’t want the text to be inserted at the beginning of a line or at the end of a line, but at a specific spot in the line. -- D 
 Hey, D. You know, over the past two years</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: How Can I Insert Text Into a Specific Column of a Text File?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2006/06/15/how-can-i-insert-text-into-a-specific-column-of-a-text-file.aspx#3298504</link><pubDate>Fri, 04 Dec 2009 22:48:04 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3298504</guid><dc:creator>pmalaison</dc:creator><description>&lt;p&gt;That is a neat scritp. &amp;nbsp;I used it to take a list and insert that list between 2 chunks of date, pretty much doing the oposite of what you are doing.&lt;/p&gt;
&lt;p&gt;There is one flaw in that script, especially with larger data set (or crappy laptop) in that by reading it all before writting the data, you may run out of memory and end up with an empty file. Here is what I ended with. &amp;nbsp;I am writting over 8000 records in lees than a seconds.&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Const ForReading = 1&lt;/p&gt;
&lt;p&gt;Const ForWriting = 2&lt;/p&gt;
&lt;p&gt;Set objFSO = CreateObject(&amp;quot;Scripting.FileSystemObject&amp;quot;)&lt;/p&gt;
&lt;p&gt;Set objFile = objFSO.OpenTextFile(&amp;quot;aimlist.txt&amp;quot;, ForReading)&lt;/p&gt;
&lt;p&gt;Set WbjFile = objFSO.OpenTextFile(&amp;quot;PRRATDAT.txt&amp;quot;, ForWriting)&lt;/p&gt;
&lt;p&gt;Do Until objFile.AtEndOfStream&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;strLine = objFile.ReadLine&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;strLeft = &amp;quot;1,USD,000,2009-01-01,null,C,&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;strRight = &amp;quot;,ALL,,,,,,T,F,F,F,F,F,T,C,AIM,,,&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;'strcusnum = (strLine, 2)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;strText = strLeft &amp;amp; strLine &amp;amp; strRight&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;strContents = strText&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;wbjFile.WriteLine strContents&lt;/p&gt;
&lt;p&gt;Loop&lt;/p&gt;
&lt;p&gt;objFile.Close&lt;/p&gt;
&lt;p&gt;wbjFile.Close&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3298504" width="1" height="1"&gt;</description></item></channel></rss>