A formatting query

Matthew Hawkins matt at mh.dropbear.id.au
Sat Feb 8 10:01:41 EST 2003


Felix Karpfen (felixk at webone.com.au) wrote:
> 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.

You can automate #2 a little bit:

$ vim -c ":set ff=dos" -c ":wq" foofile

Or you can go the whole hog:

$ w3m -dump file.html | vim -c ":set ff=dos" -c ":w file.txt" -c ":q" -

As an aside, you can use vim's session capability to shorten the command
line (it'll reduce some possible shell functionality of having the
output filename readily available though).  Make a file "cmd" like so:

:set ff=dos
:w! file.txt
:q

and you can shorten the above line to be:

$ w3m -dump file.html | vim -s cmd -

If your vimrc et al. is pretty large (I know mine is!) you can make vim
startup faster to do this task by invoking like so:

$ vim -u NONE -U NONE --noplugin

(vim won't load your .vimrc, .gvimrc or any plugin scripts)

Happy vimming :)

-- 
Matt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.samba.org/archive/linux/attachments/20030208/ada1f922/attachment.bin


More information about the linux mailing list