Tool for replacing first match per line
I've got a file that I want to convert to a CSV format.
Each line of the file is something like:
term1a term1b [pronunciation] definition
term2a term2b [pronunciation] definition
term3a term3b [pronunciation] definition
To get it into CSV, I just need to perform 3 find and replace operations:
First, replace the first " " (space) with a "," (comma).
Next, replace the first " [" (space and right-facing square bracket) with a "," (comma).
Finally, replace the first "] " (left-facing square bracket and a space) with a "," (comma).
The reason it must only be the first such occurance, is the definition area contains lots of spaces and square brackets which I'd like to leave left untouched.
|