Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


VBS Script to remove carriage returns from large file.

Posted on 2013-01-02
Medium Priority
Last Modified: 2013-01-07

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.
Question by:dondudley
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 38738179
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.

Author Comment

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


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.
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 38738331
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

The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!


Author Comment

ID: 38738573
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?


Accepted Solution

dondudley earned 0 total points
ID: 38738925
I did get it to work, sorry I must have had something wrong but it is working now.

Thank you very much.


Author Closing Comment

ID: 38750313
It was a great catch in the code and he fixed it first try.

Thanks again,

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is about my first experience with programming Arduino.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Starting up a Project

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question