end of line - Ubuntu

This is a discussion on end of line - Ubuntu ; When I transfer a text file from my non-unix box to my Linux box, a blue ^M appears at the end of every line. I cannot remember the way to remove that character. (1)Can somebody tell me how to remove ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: end of line

  1. end of line

    When I transfer a text file from my non-unix
    box to my Linux box, a blue ^M appears at the
    end of every line. I cannot remember the way
    to remove that character.

    (1)Can somebody tell me how to remove that character?

    When running vi, I want to insert "new line"
    characters using the replace macro. It does not
    work. here is the sequence that does not work...
    :%s/xy/x\ny/g
    (2)Can somebody help me with the syntax?

    Thanks,
    Charles


  2. Re: end of line

    On Thu, 21 Feb 2008 23:35:32 GMT, charles cashion wrote:
    > When I transfer a text file from my non-unix
    > box to my Linux box, a blue ^M appears at the
    > end of every line. I cannot remember the way
    > to remove that character.
    >
    > (1)Can somebody tell me how to remove that character?


    There is a unix2dos and a dos2unix script.

    Using tr there is:
    tr -d '\r' newfile

    I use two alias in my ~.bashrc

    alias dos2unix='recode ibmpc..lat1'
    alias unix2dos='recode lat1..ibmpc'

    Another method I have seen
    sed "s/\r$//" FILENAME_HERE

+ Reply to Thread