Solved

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

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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

A list of useful business intelligence software.
This guide will walk you through the essential considerations and tech stack for building scalable websites. Know how to grow your business the smart way!
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…
This video will demonstrate how to find the puppet warp tool from the edit menu and where to put the points to edit.

752 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