A formatting query

Kim Holburn kim.holburn at anu.edu.au
Sat Feb 8 07:46:23 EST 2003


At 8:26 AM +1100 2003/02/07, Felix Karpfen wrote:
>Matthew Hawkins wrote:
>> Felix Karpfen (felixk at webone.com.au) wrote:
>> > Is there a <search-and replace routine|vim plugin> that will convert a
>> > formatted text file from the Unix to the DOS format?  I have a hazy
>> > recollection that one uses NL and the other uses NL/CR.
>>
>> :set ff=dos
>> :w
>
>The wonderful thing about Linux is that there are always at least six
>different ways of strangling the bull.
>
>I tried this one first - because it is well within my current computing
>abilities.  It worked like a charm and solved my immediate problem.
>
>Pushing my luck and looking further, the full challenge is to convert a
>downloaded .html file to a formatted DOS text file.  At the moment this
>is a two-stage operation:
>
>1) w3m -dump file.html > file.txt; and
>
>2) load file.txt (w3m retains the formatting) into vim and run the above
>   routine.  If that can be done easily in one hit, I would be glad to
>   know.

1) I think you can make a copy of ~/.vimrc from your home directory and add a line with ":set ff=dos" and put it in the directory with the file where vi(vim) should pick it up - but you'll still have to open and close vi.

You'd be better off running:
w3m -dump file.html | perl -p -e 's/\n/\r\n/g' > file.txt

>Meanwhile, I would like to thank all the respondents who answered my
>query.  All other replies have been carefully filed and will be explored
>in due course.  I might even learn a bit about perl programming by the
>time I am through.

-- 
--
Kim Holburn 
Network Consultant - Telecommunications Engineering
Research School of Information Sciences and Engineering
Australian National University - Ph: +61 2 61258620 M: +61 0417820641
Email: kim.holburn at anu.edu.au  - PGP Public Key on request

Life is complex - It has real and imaginary parts.
     Andrea Leistra (rec.arts.sf.written.Robert-jordan)


More information about the linux mailing list