Sperate Columns From Single String
-
Source Data
Cust_Id,Cust_Name,Cust_Address,Cust_Salary 1,Name1,Address,12,Road,40,10000 2,Name2,Address,3,20,20000Desired Output
Cust_Id|Cust_Name|Cust_Address|Cust_Salary 1|Name1|Address,12,Road,40|10000 2|Name2|Address,3,20|20000I want to Separate Data Column Wise and Instead of Comma I want Pipe Delimiter, How to do that in Notepad++
-

Provided that the
Cust_Namecolumn contains no (comma-separated) multi-part content:Find what:
^(.+?),(.+?),(.+),(.+?)$
Replace with:$1\|$2\|$3\|$4 -
@dinkumoil Thanx a Lot it’s Working Perfectly.
-
@dinkumoil 's solution works great.
Just a note to say that
|is not a “special character” when used in the Replace with part of a regular expression. Thus it does not need to be “escaped” with\.In other words, this would have worked just as well for the Replace with:
$1|$2|$3|$4 -
Hello, @jack-patil, @dinkumoil, @alan-kilborn and All,
An other solution could be :
SEARCH
,(?=.*Address|Cust)|,(?=\d+$)REPLACE
|BR
guy038
-
@guy038 said in Sperate Columns From Single String:
,(?=.*Address|Cust)|,(?=\d+$)
I don’t think that will work on real data.
I’ve got to believe that OP has usedName1,Address, etc. as mockups in the data (below the obvious “header” line at the top), to avoid publishing sensitive data? -
Hello, @jack-patil, @dinkumoil, @alan-kilborn and All,
Yes, Alan, you’re certainly right about it ! Indeed, the strings Name1, Name2 and Address seem to be generic terms !
Just thought of this text, in a
literallyway. My bad :-((BR
guy038
-
@guy038 said in Sperate Columns From Single String:
Just thought of this text, in a literally way.
No worries!
Not only do we have to solve problems (if we choose to reply), we also have to “play detective” to know what a poster is and isn’t saying with their descriptions, even when they put their data in a nice code block. -
@Alan-Kilborn said in Sperate Columns From Single String:
|is not a “special character” when used in the Replace with part of a regular expressionHmm, you are right. Don’t know how, but in some way I had in mind that it is required. Anyway, good to know that it is not.
-
@dinkumoil said in Sperate Columns From Single String:
Hmm, you are right. Don’t know how, but in some way I had in mind that it is required. Anyway, good to know that it is not.
It really IS hard to keep all this regular expression syntax straight. :-(
I wasn’t pointing it out to pick apart your regular expression, though.
People learn new things from what they see here, even if it isn’t their question.
\|works…but if people can know they can write replacement expressions in Notepad++ involving|without a bunch of leaning toothpicks, then so much the better.