• Re: removing repeating/duplicate control char

    From spender@21:1/5 to All on Tue Feb 21 09:35:56 2023
    在 2013/3/16 3:31, peter sands 写道:
    Hello,

    I have a text file where I need to get rid of a repeating control character, I have tried sed and tr but not getting the results I expect.
    The text file is as an example:

    ^M
    text here
    text here
    ^M^M
    text here
    text here
    ^M

    I need to remove the repeating character of ^M so I have:

    ^M
    text here
    text here
    ^M
    text here
    text here
    ^M

    Any idea's please
    PS

    USE sed command , find and replace: sed -n ':a;N;$!ba;s/\n\r\r\n/\n/g' filename

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to spender on Tue Feb 21 10:03:52 2023
    On 21.02.2023 02:35, spender wrote:
    在 2013/3/16 3:31, peter sands 写道:
    ^^^^^^^^^^^
    Hello,

    I have a text file where I need to get rid of a repeating control
    character, I have tried sed and tr but not getting the results I expect.
    The text file is as an example:
    [...]

    USE sed command , find and replace: sed -n ':a;N;$!ba;s/\n\r\r\n/\n/g' filename

    After these 10 years that passed since his post I suppose that peter
    sands could have even carved the duplicate control characters out of
    marble using a chisel instead of sed.

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)