Les Mikesell wrote:
On Tue, 2006-02-28 at 14:50, Robert Moskowitz wrote:
I have had some success (read no noticed problems), moving some text conf files from a Win <cr,lf> format to Linux and have them work. For example my zone files, moving them from my Win DNS server.
But what about other files? I guess I want to know this more to prevent a mistake from crashing things, as I do have GEDIT.
If I were to build an anaconda-ks.cfg in notepad, write it to a floppy then did a linux ks=floppy, would it work?
I'm not sure there is a generic answer. Some things ignore the CR's, some don't. It's always a good idea to remove them. On Windows you can edit in wordpad instead of notepad and it will put them back. If you edit in vim (either windows or Linux versions) you can write either way with the:
set fileformat
option.
I have search the archives and google, but either I am missing the right search words, or something.
In the old days with real vi, you would: :%s/^v^m// to get rid of them, but vim doesn't like that.
It depends on how Vim recognizes the file. If Vim displays the file as a DOS file, it will hide the ^M and you can't search for it. If Vim displays the file as a unix file, it will show the ^M at the end of the line and you can search and replace it with the command shown above.
Bowie Bailey wrote:
Les Mikesell wrote:
On Tue, 2006-02-28 at 14:50, Robert Moskowitz wrote:
I have had some success (read no noticed problems), moving some text conf files from a Win <cr,lf> format to Linux and have them work. For example my zone files, moving them from my Win DNS server.
But what about other files? I guess I want to know this more to prevent a mistake from crashing things, as I do have GEDIT.
If I were to build an anaconda-ks.cfg in notepad, write it to a floppy then did a linux ks=floppy, would it work?
I'm not sure there is a generic answer. Some things ignore the CR's, some don't. It's always a good idea to remove them. On Windows you can edit in wordpad instead of notepad and it will put them back. If you edit in vim (either windows or Linux versions) you can write either way with the:
set fileformat
option.
I have search the archives and google, but either I am missing the right search words, or something.
In the old days with real vi, you would: :%s/^v^m// to get rid of them, but vim doesn't like that.
It depends on how Vim recognizes the file. If Vim displays the file as a DOS file, it will hide the ^M and you can't search for it. If Vim displays the file as a unix file, it will show the ^M at the end of the line and you can search and replace it with the command shown above.
And failing that there's always dos2unix, or even:
$ tr -d '\015' < oldfile > newfile
IME the biggest problem with DOS-format files is with scripts run using the '#!<interpreter>' syntax on the first line. Having extraneous CRs at the end of such lines can just get you a "bad interpreter" error message when you try to run the script.
James
On Wed, 2006-03-01 at 11:23, Bowie Bailey wrote:
In the old days with real vi, you would: :%s/^v^m// to get rid of them, but vim doesn't like that.
It depends on how Vim recognizes the file. If Vim displays the file as a DOS file, it will hide the ^M and you can't search for it. If Vim displays the file as a unix file, it will show the ^M at the end of the line and you can search and replace it with the command shown above.
OK, but what would convince vim to display files with ^M's as unix files? I thought it took their presence as the hint to display in DOS mode.
On Wed, 1 Mar 2006, Les Mikesell wrote:
On Wed, 2006-03-01 at 11:23, Bowie Bailey wrote:
In the old days with real vi, you would: :%s/^v^m// to get rid of them, but vim doesn't like that.
It depends on how Vim recognizes the file. If Vim displays the file as a DOS file, it will hide the ^M and you can't search for it. If Vim displays the file as a unix file, it will show the ^M at the end of the line and you can search and replace it with the command shown above.
OK, but what would convince vim to display files with ^M's as unix files? I thought it took their presence as the hint to display in DOS mode.
If you get the dreaded '[dos]' indicator in vim, just do
:set fileformat=unix
For fun, try
:set fileformat=mac
Les Mikesell wrote:
On Wed, 2006-03-01 at 11:23, Bowie Bailey wrote:
In the old days with real vi, you would: :%s/^v^m// to get rid of them, but vim doesn't like that.
It depends on how Vim recognizes the file. If Vim displays the file as a DOS file, it will hide the ^M and you can't search for it. If Vim displays the file as a unix file, it will show the ^M at the end of the line and you can search and replace it with the command shown above.
OK, but what would convince vim to display files with ^M's as unix files? I thought it took their presence as the hint to display in DOS mode.
vim will assume a file is unix format if any line contains just one single lf. If you have a file that is cr/lf everywhere except 2 lines from the end has a lf only line, vim will use lf mode. It would have been nice if it just checked the first few line or 2.
echo -en "dos\r\ndos\r\nunix\ndos\r\n" > text.mixed
Vim text.mixed will use unix eol mode when opened.
At 05:45 PM 3/1/2006, Adam Gibson wrote:
Les Mikesell wrote:
On Wed, 2006-03-01 at 11:23, Bowie Bailey wrote:
In the old days with real vi, you would: :%s/^v^m// to get rid of them, but vim doesn't like that.
It depends on how Vim recognizes the file. If Vim displays the file as a DOS file, it will hide the ^M and you can't search for it. If Vim displays the file as a unix file, it will show the ^M at the end of the line and you can search and replace it with the command shown above.
Hey, thanks for all of the info on DOS and Unix file editing and all the things that CAN go wrong if you are NOT careful.
So I have been careful to stay consistant. As much as I can....
On Wed, 2006-03-01 at 19:44 -0500, Robert Moskowitz wrote:
At 05:45 PM 3/1/2006, Adam Gibson wrote:
Les Mikesell wrote:
On Wed, 2006-03-01 at 11:23, Bowie Bailey wrote:
In the old days with real vi, you would: :%s/^v^m// to get rid of them, but vim doesn't like that.
It depends on how Vim recognizes the file. If Vim displays the file as a DOS file, it will hide the ^M and you can't search for it. If Vim displays the file as a unix file, it will show the ^M at the end of the line and you can search and replace it with the command shown above.
Hey, thanks for all of the info on DOS and Unix file editing and all the things that CAN go wrong if you are NOT careful.
So I have been careful to stay consistant. As much as I can....
I have found that if I install CentOS on all my machines that used to run windows ... I have a fairly consistent UNIX only set of text files ...
Just one of many suggestions :)
At 08:05 PM 3/1/2006, Johnny Hughes wrote:
On Wed, 2006-03-01 at 19:44 -0500, Robert Moskowitz wrote:
At 05:45 PM 3/1/2006, Adam Gibson wrote:
Les Mikesell wrote:
On Wed, 2006-03-01 at 11:23, Bowie Bailey wrote:
In the old days with real vi, you would: :%s/^v^m// to get rid of them, but vim doesn't like that.
It depends on how Vim recognizes the file. If Vim displays the file as a DOS file, it will hide the ^M and you can't search for it. If Vim displays the file as a unix file, it will show the ^M at the end of the line and you can search and replace it with the command shown above.
Hey, thanks for all of the info on DOS and Unix file editing and all the things that CAN go wrong if you are NOT careful.
So I have been careful to stay consistant. As much as I can....
I have found that if I install CentOS on all my machines that used to run windows ... I have a fairly consistent UNIX only set of text files ...
Work in progress!
Just one of many suggestions :)
And actually the one that is in my target sights.
There are still a number of important decision points:
Do I actually maintain my NT domain as I have been planing, or do I just switch to NFS?
How will I support printing if I punt on NetBios services?
The death of Eudora? Or should I attempt WINE? Evolution of Thunderbird?
I am actually within a short step to moving into the Linux camp.....