Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add a comma to the last character of a line in a textfile

I have a very long text file full of email adresses, from an export of a newsletter db. To import them in another system I need to have these adresses separated by a comma.

I'm trying to do a search/replace using regex. So far I can find the last character of each line with :

[^\n]$

So that's for my "Search" field. But I don't know with what to put into "Replace". I'm very new to regex, is there a wildcard that would allow to do something like :

[any characted found],
like image 400
mike23 Avatar asked Nov 27 '22 14:11

mike23


1 Answers

You could search for ([^\n])$ and replace it by \1, – depending on your RegEx engine.

like image 137
Flygenring Avatar answered Dec 04 '22 03:12

Flygenring