Question

How can i split my words in new line (i have a lot of them) currently separated with comma, Example of my file contains words in a single line:

Viktor, Vajt, Adios, Test, Line, Word1, Word2, etc...

The the output file should look like:

Viktor
Vajt
Adios
Test
...
Was it helpful?

Solution

If you are using NotePad++, this can easily be done. See image below

enter image description here

OTHER TIPS

If you – for some reason – want to stick with the doc Format (to keep formatting, etc.) you could use LibreOffice (http://de.libreoffice.org/) to do the following replacement:

LibreOffice RegeEx replacement

I agree installing LibreOffice just for this replacement would be overkill though.

Not sure what language you are in but you could use an explode/split function which would create an array of values split at ','. Then you could loop through the array and append the new line special character "\n". You would wind up with something like:

$fileContentsAsString; //read file into string variable

$valuesArray = explode(',' $fileContentsAsString);

$outputString;
foreach($valuesArray as $item){
 $outputString .= $item . "\n";
}

For a quick text edititng i'm using online tool (http://regexptool.org/). Also you can do it step by step (screen).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top