I am trying to clean up a synonymous textfile that I have.
So I would like to know if it's possible to do a replace function to change the first comma sign on each line to | or something else and not change the following commas on that line. But jump to next line and do a new replace.
The current file is based like this:
word1,synonym1,synonym 2,syn o nym3
word2,synonym1,synonym 2,syn o nym3
And I would like to become like this.
word1|synonym1,synonym 2,syn o nym3
word2|synonym1,synonym 2,syn o nym3
If not but possible, then I would be happy to hear other solutions.
Thanks in advance.
TomYam
Thailand
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The 1 per line checkbox is in the CTRL+R advanced Find/Replace dialog, which I almost use for anything to replace. It has a lot more checkboxes (including regex) than the regular CTRL+F Find dialog.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi and big thumbs up for a great editor.
I am trying to clean up a synonymous textfile that I have.
So I would like to know if it's possible to do a replace function to change the first comma sign on each line to | or something else and not change the following commas on that line. But jump to next line and do a new replace.
The current file is based like this:
word1,synonym1,synonym 2,syn o nym3
word2,synonym1,synonym 2,syn o nym3
And I would like to become like this.
word1|synonym1,synonym 2,syn o nym3
word2|synonym1,synonym 2,syn o nym3
If not but possible, then I would be happy to hear other solutions.
Thanks in advance.
TomYam
Thailand
Thanks alot for your help.
Tough it was not as straightforward as I thought.
Needed to use the check-box of "regular expression".
Then it worked like a charm. :-)
As for "1 per line", tried to look for a setting for it, but I seem to be a little blind, as I have not found it.
But big thanks for this help..
TomYam..
The 1 per line checkbox is in the CTRL+R advanced Find/Replace dialog, which I almost use for anything to replace. It has a lot more checkboxes (including regex) than the regular CTRL+F Find dialog.
Did you tried the option "1 per line"?
Of course, this works for the first occurrence on a line. If you want to replace the second... You can use regular expressions to do so.
Find field:
^([^,]+,[^,]+),
Replace field:
\1|
This will match anything up to and including the second comma, re-placing the text before it and replacing the comma itself by the pipe character.
For the first occurrence this is also possible:
Find field:
^([^,]+),
Replace field:
\1|
You may guess how this could be explained or described.