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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB Script to Edit a CSV and Replace Characters Within a Field

Status
Not open for further replies.

Jamaica25

Programmer
Jul 16, 2013
1
US
I am new to scripting and need a script to take a long line of data out of a field in a .csv, and put it into a different column, but in the same row. I am trying to separate the data. An example of the data is listed below:

This is the format the data is in originally in one field:

"The folder /Calendar in Mailbox 'Maxwell, Cheryl' was opened by user MON\127519
Display Name: Calendar
Accessing User: /o=ESR/ou=Exchange Administrative Group (ABCDEFGHIJKLM1234)/cn=Recipients/cn=127519
Mailbox: /O=ESR/OU=SRCMC/cn=Recipients/cn=123000
Administrative Rights: false
Identifier: 000000007D31DF90
Client Information (if Available):
Machine Name: MONXP-80071590.MON.NET
Address: 10.16.5.85
Process Name: OUTLOOK.EXE
Process Id: 0
Application Id: N/A "

I need the data separated into different columns as follows and the columns dont need any headers. I just need the data separated:


Calendar

/o=ESR/ou=ECH/cn=Recipients/cn=TB1401

/O=ESR/OU=SRCMC/cn=Recipients/cn=123000

false

0000000134B95D70

MONXP-842EBBEF.MON.NET

10.16.5.85

OUTLOOK.EXE

0

"N/A
 
For example if you have this
line = "Accessing User: /o=ESR/ou=Exchange Administrative Group"

There are several ways how to do it:
1) You can search for a subtring "Accessing User:" in line and from the position take the rest of the line.
2) You can split the line into array of strings using the delimiter ":" and take the second element of the array
3) You can use regexp (Regular Expressions)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top