Search_Replace with a Carriage Return

Hey folks,
I've been working on this for some time. Seems simple, but I'm stumped.

I need the following data format:

New_York:Commercial
         Geology
         Geophysics
         Petrophysics
         Production_Engineering
         Reservoir_Engineering
Pasadena:Commercial
         Geology
         Geophysics
         Petrophysics
         Production_Engineering
         Reservoir_Engineering

To look like this:

New_York
        Commercial
        Geology
        Geophysics
        Petrophysics
        Production_Engineering
        Reservoir_Engineering
Pasadena
        Commercial
        Geology
        Geophysics
        Petrophysics
        Production_Engineering
        Reservoir_Engineering

I've used this command successfully in VI:

s/:/^M        /g

But cannot seem to get it right within a script. I use the following line:

sed -e 's/:/^M      /g' filename

but it will remove the "New_York:" which is what I need.

Any help would be greatly appreciated.

Thank You!

You can try:

tr ':' '\n' < File

Are you sure it's actually removing it, and not just a display issue?

e.g. this works fine on cygwin:

$ sed -e 's/:/\n\t/g' x.txt
New_York
        Commercial
         Geology
         Geophysics
         Petrophysics
         Production_Engineering
         Reservoir_Engineering
Pasadena
        Commercial
         Geology
         Geophysics
         Petrophysics
         Production_Engineering
         Reservoir_Engineering

Carriage return and newline are not the same thing.

Carriage return moves to the beginning of the line but does not move it down -- probably causing the display issue you saw.

Newline, \n, moves it down one line and moves the cursor to the beginning of the line.

I'm working this through Exceed on Demand. It might be a display issue, but this script will be deployed globally and all that will be using it will be seeing what I'm seeing.

Using the "sed -e 's/:/\n\t/g' " removed the ":" but didn't place a new line. However, the tr command worked.

Thanks!

You might have a crummy old sed which doesn't even support \n.