[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Script para quitar bloques html



On Tue, 18 Sep 2001, cesar wrote:

> 
>  Nas.
> 
>    Eso puedes hacerlo con sed y con awk.
>    Si me dices qué es exactamente lo que quieres hacer 
>  te monto un script.
> 
>  Un saludo.
>   César
>  Insallah
> 
> Miguel Angel wrote:

Pues yo me hice un script muy sencillo.

==============8<--------(html2txt.bash)------------------------------
#!/bin/bash
TEMP0=/tmp/html2txt.txt
TEMP1=/tmp/html2txt.sed1.$$
TEMP2=/tmp/html2txt.sed2.$$
cat <<-FIN > $TEMP1
s/<\/.*>//g
FIN
cat <<-FIN > $TEMP2
s/\&aacute;/á/g
s/\&eacute;/é/g
s/\&iacute;/í/g
s/\&oacute;/ó/g
s/\&uacute;/ú/g
s/\&ntilde;/ñ/g
s/\&Ntilde;/Ñ/g
s/<.*>//g
FIN
chmod 777  $TEMP1 $TEMP2
for i in $*
do
 sed  -f $TEMP1 $i > $TEMP0
 sed  -f $TEMP2 $TEMP0 > $i.txt
done
#rm $TEMP0 $TEMP1 $TEMP3
==============8<--------(html2txt.bash)------------------------------

Uso:

html2txt.bash fichero1.html fichero2.html .....


Un saludo

Antonio Castro

+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
        /\     /\      Ciberdroide Informática (Tienda de Linux)
          \\W//            <<< http://www.ciberdroide.com >>>
	 _|0 0|_                                                    
+-oOOO--(___o___)--OOOo----------------------------------------------------+ 
|  . . . . U U . . . . Antonio Castro Snurmacher  acastro@ciberdroide.com  |  
|  . . . . . . . . . .                                                     | 
+()()()----------()()()----------------------------------------------------+
| *** 1.700 sitios clasificados por temas sobre Linux en ***Donde_Linux*** |
| <<< http://www.ciberdroide.com/misc/donde/dondelinux.html >>>            |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+




Reply to: