I have a text file with hundreds of lines. Each line contain the below information:
software.cisco.com , Added by IT, ZZ 6584
What I am trying to do is insert carriage return where the first comma is. I'm able to do this with search/replace and using the /n expression. Problem is it inserts carriage return twice leaving me with 3 lines. I am trying to insert carriage return at first comma only and keep rest of line.
Before:
software.cisco.com , Added by IT, ZZ 6584
After:
software.cisco.com
#Added by IT, ZZ 6584
Use
^(.*?),\s*
Replacement: $1\n#
.
See proof.
EXPLANATION
--------------------------------------------------------------------------------
^ the beginning of the string
--------------------------------------------------------------------------------
( group and capture to \1:
--------------------------------------------------------------------------------
.*? any character except \n (0 or more times
(matching the least amount possible))
--------------------------------------------------------------------------------
) end of \1
--------------------------------------------------------------------------------
, ','
--------------------------------------------------------------------------------
\s* whitespace (\n, \r, \t, \f, and " ") (0 or
more times (matching the most amount
possible))