Quick Hack: Replace a separator with newline
12May09
Most programmers will know the situation: you want to analyze the console output of some program but program spits the interesting section all in a single line. You want to separate the single strings and put them each in a separate line. How do you do it?
In Unix, this is relatively easy using the sed tool (using “;” as separator):
sed -e "s/;/\\n/g" myfile.txt
But Windows doesn’t provide a built-in tool for things like that, and shell emulators like cygwin are not available on all computers.
However, if you have access to Ultraedit, you can simply to a Search & Replace. Search for your separator (“;”) and replace it with “^p”. Voila, you just created a readable list of your output.
Filed under: Nothing Special | Leave a Comment
Tags: cygwin, editor, newline, replace, sed, separator, ultraedit
No Responses Yet to “Quick Hack: Replace a separator with newline”