Quick Hack: Replace a separator with newline

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?

Using a Unix Console

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.

Using Ultraedit

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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s