Solved

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

Posted on 2011-03-10
5
2,513 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
Skype is a P2P (Peer to Peer) instant messaging and VOIP (Voice over IP) service – as well as a whole lot more.
The viewer will learn how to set up a document for the web and print and the recommended PPI for printing.
The viewer will learn common shortcuts with easy ways to remember them. The viewer will then learn where to find all of the keyboard shortcuts, how to create/change them, and how to speed up their workflow.

707 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

11 Experts available now in Live!

Get 1:1 Help Now