Vidiot wrote:
> >getting closer. In vi if I set ff=mac and save the file, when I reopen it it is
> >readable! yeah!! Now does any of you vi gurus out there know if I can use a vi
> >script or macro to open the file, set ff=mac and save it to the same name with no
> >user intervention?
> >
> >I have never done this sort of thing before but seems like it might be possible
> >although none of my books that have a sort of intro to vi discuss it.
> >
> >Any help appreciated.
> >
> >Bret
>
> I didn't know about the ff=mac thing, since it is not part of real vi. It is
> an extension. What is ff supposed to mean anyway?
ff = fileformat
I bet it would d the same for dos file with the crlf crap too. In fact IIRC someone
a while back tried to tel me this but by the time it was back to me I had it solved
another way. Kind of like this time. What I did was search the archives again and
found a post Charles Galpin made with a perl script in a kinda sorta related
problem. Between that and the old camel book (I do have a real perl book) I used a
one line perl script edit the file in place (I think that is what it is called) and
make a backup at the same time just in case.
Here is the command for you poor souls a year from now trying to do something
similar.
perl -pi.bak -e 's/\x0D/\x0A/g;' top.html
This creates a backupfile called top.html.bak, and iterates through the file
(actually one line in this case) and does a global replace on the hex byte = 0D with
0A. Worked so fast I did not think that it did anything. But Eureka! a pretty little
html file that I can actually read and work on.
I thought I felt a learnin' coming on and sure enough :) Now if some one will just
tell me about the vi script thing so I can file it away...
Thanks for your help.
Bret
_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list