I have a list of phrases with spaces:
Part One
Part Two
Parts Three And Four
I would like to use Vim to process the list to produce this:
part_one,"Part One"
part_two,"Part Two"
parts_three_and_four,"Parts Three And Four"
I can use this regex:
:%s/.*/\L\0\E,"\0"/
to get me to this that is really close:
part one,"Part One"
part two,"Part Two"
parts three and four,"Parts Three And Four"
Is there a way to replace all spaces before the comma on each with underscores? Or as a modification of the above regular expression or as a second command?
source
share