Imaginemos que tenemos un archivo HTML en nuestro disco duro (o en la red) y queremos grabar el resultado final en un archivo de texto:
Código: Seleccionar todo
html2text -ascii -o archivo_resultante.txt archivo_html.html
El código anterior creará un archivo de texto (archivo_resultante.txt) a partir de un archivo html (archivo_html.html).
Los parámetros que permite html2text són:
Código: Seleccionar todo
This is html2text, version 1.3.2a
Usage:
html2text -help
html2text -version
html2text [ -unparse | -check ] [ -debug-scanner ] [ -debug-parser ] \
[ -rcfile <file> ] [ -style ( compact | pretty ) ] [ -width <w> ] \
[ -o <file> ] [ -nobs ] [ -ascii | -utf8 ] [ <input-url> ] ...
Formats HTML document(s) read from <input-url> or STDIN and generates ASCII
text.
-help Print this text and exit
-version Print program version and copyright notice
-unparse Generate HTML instead of ASCII output
-check Do syntax checking only
-debug-scanner Report parsed tokens on STDERR (debugging)
-debug-parser Report parser activity on STDERR (debugging)
-rcfile <file> Read <file> instead of "$HOME/.html2textrc"
-style compact Create a "compact" output format (default)
-style pretty Insert some vertical space for nicer output
-width <w> Optimize for screen widths other than 79
-o <file> Redirect output into <file>
-nobs Do not use backspaces for boldface and underlining
-ascii Use plain ASCII for output instead of ISO-8859-1
-utf8 Assume both terminal and input stream are in UTF-8 mode
-nometa Don't try to recode input using 'meta' tag
No te pierdas el tema anterior: Como borrar archivos segun su tamaño