Solved

How Do I Delete Everything Before (Or After) The Comma "," In Notepad++

Posted on 2011-03-10
5
2,541 Views
Last Modified: 2012-05-11
I just exported a list of SAM account names into a text file.  The format in the text file is:
Display Name,SAMaccountName  ex:  Brian Dettewiller,bdettewiller

i have 955 lines of this data in the text file.  How do I, in Notepad++, delete everything in front of the comma "," so that all I am left with is the SAMaccountName?  I know this is a Replace function and something to do with the Extended options, but I do not know how to do this.  The little bit of info there is on this isn't very clear to me.
0
Comment
Question by:Monterio
  • 3
  • 2
5 Comments
 
LVL 7

Expert Comment

by:Murugesan Nagarajan
ID: 35106274
Press Ctrl H  ( or click "Search button" => Replace )

In the message box:
Mention the following in Find what:
([A-Za-z ]*),([a-zA-Z]*) *[a-zA-Z :]* *[a-zA-Z,]*

Open in new window

Mention the following in Replace with:

\2

Open in new window



Select Search mode as Regular Expression
then click Replace all
ReplaceRegularExpressionNotepadP.JPG
0
 
LVL 1

Author Comment

by:Monterio
ID: 35108827
Hi, Murugesandins.

Thanks for the assistance.  That did the trick.  Your suggestion has deleted everything but has left a space in front SAM account name.  Is it safe to assume that I can run the exact same thing but in the Replace field change the "\2" to whatever is representative for say a hyphen (-)?  What would I use for that, and more importantly is there some sort of reference doc that has these character sets in it?
0
 
LVL 7

Expert Comment

by:Murugesan Nagarajan
ID: 35125436
Kindly let me know:
1. the contents of the text file(opened in notepad++) => for example 3 or 4 lines
2. The output after replacement.


>> What would I use for that, and more importantly is there some sort of reference doc that has these character sets in it?
Can you explain this in detail.
0
 
LVL 1

Author Comment

by:Monterio
ID: 35128532
I figured out what happened actually.  The space that was left was due to the way I copied your suggestion into the field.  Somehow it created a space before the first character of each SAM name on each line of the file. I restored the file, and was much more careful about the copy and it worked withouth any hiccups.  So obviously I goofed up the copy & paste...an illegal character in there or something.

As far as my last question goes, I'm referring to the "/2"m, which I assume is represents the commna (",").  If I want to substitute that commna for another character, where would I find a listing of the codes like, "/2" that represent an ACII character...what I refer to as a "character set".
0
 
LVL 7

Accepted Solution

by:
Murugesan Nagarajan earned 125 total points
ID: 35135272
In the following code
([A-Za-z ]*),([a-zA-Z]*) *[a-zA-Z :]* *[a-zA-Z,]*

Open in new window


\1 represents "Display Name"
\2 represents "SAMaccountName"




In the following code:
([A-Za-z ]*),([a-zA-Z]*) *([a-zA-Z :]* *[a-zA-Z,]*)

Open in new window

\1 represents "Display Name"
\2 represents "SAMaccountName"
\3 represents "ex:  Brian Dettewiller,bdettewiller"



Also it is not /2 it is \2
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
Healthcare organizations in the United States must adhere to the guidance of both the HIPAA (Health Insurance Portability and Accountability Act) and HITECH (Health Information Technology for Economic and Clinical Health Act) for securing and protec…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
An overview on how to enroll an hourly employee into the employee database and how to give them access into the clock in terminal.

863 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

27 Experts available now in Live!

Get 1:1 Help Now