[Unix]Remove line breaks
Solved
loic
-
batmat Posted messages 1880 Registration date Status Membre -
batmat Posted messages 1880 Registration date Status Membre -
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
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 réponses
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:
In tmp you have "tonfichier" without line breaks, so if you want to replace the original file, you need to do
@++
Post, post again and always :-).
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 :-).
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
@++
Are you hesitating between Linux and Windows?
Do you want to spend time or money? :-D
It all depends on the text editor you are using...
The most common one is Vi. You will find everything you need in the PDF document below (regarding vi)
http://riceinfo.rice.edu/Computer/Documents/Unix/unix4.01.pdf
:O
The most common one is Vi. You will find everything you need in the PDF document below (regarding vi)
http://riceinfo.rice.edu/Computer/Documents/Unix/unix4.01.pdf
:O