Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Ciao!
Devo creare un file testo (html) partendo da un file esistente e aggiungendo dati.
I file sono in una partizione FAT.
Quindi ho il file show.html in una partizione FAT che non ha il fine linea (^M) specifico dell'ambiente Win.
Faccio la copia nella mia directory ~miky (Linux)
cp show.html ~/tmp.html
Il file tmp.html non ha ancora i fastidiosi ^M
Adesso aggiungo testo:
echo " bla bla bla" >> tmp.html
A questo punto tutte le righe precedenti si ritovano con un ^M a fine riga.
Perche'?
Quindi ho il file show.html in una partizione FAT che non ha il fine linea (^M) specifico dell'ambiente Win.
...
Il file tmp.html non ha ancora i fastidiosi ^M
Sei sicuro??
Come sono stati creati i file sulla partizione FAT?
Sorry!
I should have written in English! I didn't realise! Sorry!
The original file, show.html was created with a Windows text editor. So it has all that ^M to end every line.
Only that the new vi is too "smart" and doesn't show me the ^M if the file is a DOS file. My script processes it and I get a "Linux file". Now vi is "smart" again and shows me that dammed ^Ms.
Vi hid those ^M because it detected you were using Windows line endings.
Your problem is, when you run it through the script, you introduced a line that ends in LF, rather than the CR+LF that's used throughout the rest of your file. This made Vi think you were using linux line endings, so it decided to show those ^M again.If you want to get rid of them, make all the line endings either LF or CR+LF, but not a mix of both.
Well, I need a DOS file! And this is because a browser likes it that way. It does not work properly if there are no CR+LF in the JavaScript code lines.
All I want is to get rid of that vi's option to show me whatever it likes!
As someone else said, use unix2dos to convert from CR line endings to CR+LF throughout a whole file. If you want vi to use dos line endings type :set ff=dos inside vi while in command mode.
BTW: If you use semi-colons(;) at the end of each statement in your javascript like you're supposed to, then you shouldn't have to worry about CR+LF's.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.