Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2011-03-10
5
Medium Priority
?
2,735 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
Are you an Exchange administrator employed with an organization? And, have you encountered a corrupt Exchange database due to which you are not able to open its EDB file. This article will explain all the steps to repair corrupt Exchange database.
Using Adobe Premiere Pro, the viewer will learn how to set up a sequence with proper settings, importing pictures, rendering, and exporting the finished product.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

671 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