Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

REMOVE BREAKS FROM A TEXTFILE 1

Status
Not open for further replies.

PrgrmsAll

Programmer
Apr 8, 2003
180
0
0
US
I have a textfile that contains about 60,000 fixed width records (50-bytes). With VB, I need to open the file and remove the CRLFs so that I effectively have one long byte-stream (we are looking at about 3 MILLION characters).

I can open the file and read/write, etc. but can anyone tell me the best method for removing the line breaks and effectively concatenating this whole file into one big long text stream? I guess I am asking If there is a replace function I can use (replace <breaks> with <blanks>)?

Thanks in advance.
 
Yes, it is called Replace().

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Code:
With New FileSystemObject
   NewString = Replace(.OpenTextFile("C:\myFile.Txt").ReadAll,vbCrLf," ")
End With

[small]No! No! You're not thinking ... you're only being logical.
- Neils Bohr[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top