Solved

VBS Script to remove carriage returns from large file.

Posted on 2013-01-02
6
237 Views
Last Modified: 2013-01-07
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
0
Comment
Question by:dondudley
  • 4
  • 2
6 Comments
 
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.
0
 

Author Comment

by:dondudley
ID: 38738209
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.
0
 
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

0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:dondudley
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?

Thanks,
Don
0
 

Accepted Solution

by:
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.

Don
0
 

Author Closing Comment

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

Thanks again,
Don
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
array6 challenfge 6 83
Eclipse Neon start with Admin account only 6 95
creating threads in delphi 1 84
Adding Namespace to the second node of the xml 16 65
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
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 …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

867 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now