[Unix]Remove line breaks

Solved
loic -  
batmat Posted messages 1880 Registration date   Status Member -
Hello,

in a file I have line breaks and I'd like to know how to remove them.

Example: it's
nice

I want: it's nice

7 answers

  1. batmat Posted messages 1880 Registration date   Status Member 114
     
    And from what I see, it's more than just the \r, it's the newline that you want to remove. In fact, it's the \n

    Sometimes you have both \r\n

    You need to use the tr command to do this:
    $tr -d '\r\n' < tonfichier > tmp


    In tmp you have "tonfichier" without line breaks, so if you want to replace the original file, you need to do
    mv tmp tonfichier


    @++
    Post, post again and always :-).
    7
  2. batmat Posted messages 1880 Registration date   Status Member 114
     
    Otherwise Loic, you could maybe say "thank you" or "that's not good for me", but say something ...

    @++

    Are you hesitating between Linux and Windows?
    Do you want to spend time or money? :-D
    5
  3. batmat Posted messages 1880 Registration date   Status Member 114
     
    The carriage return is \r not \p

    @++
    Post, post again and always :-)
    3
  4. Pascal
     
    Hi,
    I might be getting ahead of myself, but I think the code \p means "carriage return". So try to do a delete by specifying \p without quotes.

    :-)
    1
    1. loic
       
      and how do you do the delete?
      0
  5. batmat Posted messages 1880 Registration date   Status Member 114
     
    So, have you tried?

    @++
    Post, post again and always :-)
    1
  6. Kuching Posted messages 2702 Status Contributor 157
     
    Hi Loic,

    I might not have understood the thing, but next time do your FTP in ASCII, it could help (O::

    See you  K.
    1
    1. batmat Posted messages 1880 Registration date   Status Member 114
       
      Why are you talking about ftp Kuching? Reference to another thread?!?

      @++
      Post, post again and always :-)
      0
      1. Kuching Posted messages 2702 Status Contributor 157 > batmat Posted messages 1880 Registration date   Status Member
         
        Arghhh I read it wrong! I was thinking about the /n at the end of each line when you don't convert to ASCII )O:: Read it wrong! Sorry!

        See you later K.
        0