Avatar of dondudley
dondudley
 asked on

VBS Script to remove carriage returns from large file.

a









b
As you can see in this the example above are many carriage returns and I need to remove them all. I have attached the vbs code that I tried with no change to the file.
Remove--returns.vbs
Programming

Avatar of undefined
Last Comment
dondudley

8/22/2022 - Mon
kaufmed

Are you certain the target file has CRLF as its line endings? Perhaps the file only uses LF, at which point your Replace call would not find anything.
dondudley

ASKER
Here is an example of the original code and notice that it only has one extra carriage return.

2.80;176;4.93;01/20/2012
;
00904-5125-59
;


In my file it is all together in a text file and where the 59; is there is actually a carriage return between the 9 and the semicolon but here is shows different but that is what I need to remove.
kaufmed

Try altering line 9 to:

strNewText = Replace(Replace(strText, chr(013), ""), chr(010), "")   ' chr(010) = line feed chr(013) = carriage return 

Open in new window

All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
dondudley

ASKER
Tried it but didn't seem to work. I would like to send the original file to you but it is business confidential. Is there anyway I can get the file to you without anyone seeing it?

Thanks,
Don
ASKER CERTIFIED SOLUTION
dondudley

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
dondudley

ASKER
It was a great catch in the code and he fixed it first try.

Thanks again,
Don