Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2011-03-10
5
Medium Priority
?
2,781 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 9

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 9

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 9

Accepted Solution

by:
Murugesan Nagarajan earned 500 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Have you ever run into that annoying problem where the computer won't boot?  Wouldn't it be great if you had a tool that would make that disk boot again?  I have found one tool that works more often than not ...
Stellar Exchange Toolkit: this 5 in 1 toolkit comes loaded with mega-software tool. Here’s an introduction to tools’ usage and advantages:
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

824 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