Data Parsing - Removing a string and replacing it with a carriage return

Posted on 2006-06-19
Last Modified: 2010-04-17
I have a document with approximately 4,000 email addresses that need to be parsed into a single column by having the ";" (semicolon) string removed and replaced with a carriage return. Can anyone recommend a PERL or VBA snippet that can do this in fairly short order. Maybe theres an advanced text editor that someone could recommend that could do the same.



Any help is greatly appreciated :)
Question by:nanohurtz
LVL 76

Expert Comment

Comment Utility
MyNewString = Replace(MyString, ";", vbCR)
LVL 76

Accepted Solution

GrahamSkan earned 500 total points
Comment Utility
In Word,
Find: ;
Replace; ^p

Expert Comment

Comment Utility
I like textpad.  Simply do a search for ;  (colon space if you have spaces after the colon). Replace with \n.  It's fast!
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

LVL 85

Expert Comment

by:Mike Tomlinson
Comment Utility
Using a VBScript (.vbs) file:

Option Explicit

Const ForReading = 1, ForWriting = 2

Dim fileName, fso, f, lines

fileName = "c:\someFile.txt"

Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(fileName) Then
   Set f = fso.OpenTextFile(fileName, ForReading, False)
   If Not f.AtEndOfStream Then
      lines = f.ReadAll

      lines = Replace(lines, "; ", vbCrLf)

      Set f = fso.OpenTextFile(fileName, ForWriting, True)
      MsgBox fileName, vbOKOnly, "Changes Made"
      MsgBox fileName, vbOKOnly, "File Is Empty"
   End If
   MsgBox fileName, vbOKOnly, "File Not Found"
End If

Author Comment

Comment Utility
...and there you have it, a solution right under my nose and no need for scripting. Thanks a million Graham.
LVL 76

Expert Comment

Comment Utility
Thanks nanohurtz.

Don't feel bad. The answer is always obvious afterwards. It took me two goes.

cheers, graham

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
countClumps  challenge 10 87
c# combobox autocomplete behavior 6 89
factorial example challenge 10 59
strCount chalenge 3 50
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
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 …

728 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

10 Experts available now in Live!

Get 1:1 Help Now