Micro Focus QTP (UFT) Forums
How to concatenate 2 text files - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: How to concatenate 2 text files (/Thread-How-to-concatenate-2-text-files)



How to concatenate 2 text files - kkishore12345 - 12-18-2008

Hi All,

Can you pls help me on the below scenario?

I am trying to capture the Text from 2 different web pages and stored in a Text file. I used the following code
1st FileSadWeb page1)
--------
Code:
sVar=br(br).pg(pg).object.DocumentElement.Innertext
set oFSO=CreateObject("scripting.Filesystemobject")
set oFile1=oFSO.CreateTextFile("C:\temp\file1.txt",ForWriting,True)
oFile1.write sVar
oFile1.close
2nd FileSadweb page2)
-------
Code:
sVar2=br(br).pg(pg).object.DocumentElement.Innertext
set oFile1=oFSO.CreateTextFile("C:\temp\file2.txt",ForWriting,True)
oFile2.write sVar2
oFile2.Close

Now, I have to concatenate these two files and save in a different file. I need to remove extra spaces as well.

Can you please provide me the solution to do this?

Earliest reply is highly appreciated!
Thanks,
kishore


RE: How to concatenate 2 text files - Ankur - 12-18-2008

Did you try the Append mode?


RE: How to concatenate 2 text files - kkishore12345 - 12-19-2008

Ankur,

Can you pls provide code for Appending 2 files?

I have created a file in Append mode and am able to write the content into it. However, I need information on how to combine 2 text files and read into a single file? I will be capturing text from 2 different web sites and will be writing into a Text file. For this, I would request your detailed answer.

Team-->I welcome anyone's complete answer.

Earliest reply would be gr
Thanks,
kishore


RE: How to concatenate 2 text files - kkishore12345 - 01-03-2009

Team,

I tried with Append mode and got the answer. Thanks Ankur for the support!
Kishore