Hoy he estado liado con otra cosa, dejando para el final el listado de noticias. De todos modos, por si alguien se anima, ahí va la receta:
1) Echar un ojo a la prensa económica cada día, abrir las noticias en pestañas diferentes, y guardarlas con "añadir todas las pestañas abiertas a marcadores" (de lunes a domingo). [20-30 minutos diarios]
2) Exportar los marcadores a html. [5 minutos]
3) Copiar y pegar en ficheros de lunes.txt a domingo.txt [5 minutos]
4) Como base, y sólo para 5 diarios prefijados, ejecuto el script 'genlinks.sh' (que a su vez llama a 'h2s.sh', son muy cutres, pero para lo que es, ya me vale). [1 minuto si lo ejecutas en un Linux, más de 10 si es bajo Cygwin]
5) Recoger entradas de blogs [45 minutos]
6) Recoger índices de tipos de interés, petróleo, y euro/dólar [15 minutos]
7) Revisar y adaptar para Barrapunto [15 minutos]
Código fuente de los scripts (generan porciones de código PHP a partir de los marcadores guardados con Firefox):
<i>h2s.sh <incio></i> #!/bin/sh sed "s/<DT>//" | sed "s/[^\"]*<A HREF=\"\([^\"]*\)\"[^\>]*>\([^<]*\)[^\"]*/{\2\|\1} /" | sed "s/\ \-\ [0-9]*\/[0-9]*\/[0-9]*\ \-\ [0-9]*\ \-\ elEconomista.es//" | sed "s/ - [0-9]*|/|/" | sed "s/ - Expansi.n.com|/|/" | sed "s/ - [cC]otizalia.com|/|/" | sed "s/ . ELPA.S.com|/|/" <i>h2s.sh <fin></i>
for ((k=0;k<$MEDIOS_NUM_ELEMS;k++)); do echo ${SRC[${j}]}. ${MEDIOS[${k}]}
./h2s.sh < ${SRC[${j}]}.txt | grep ${MEDIOS[${k}]} | sed "s/{/\t\tfmt__link_prensaT2(\$t_xx, \$${SRC[${j}]}, \$f_${MEDIOS[${k}]}, \"/" | sed "s/|/\", \"/" | sed "s/}/\");/" >tmp.txt
cat tmp.txt | while read line do # echo $line TESTPARAM=$line
Test_empleo if [ $TESTRES -gt 0 ] then echo $line | sed "s/t_xx/t_empleo/" >> xx${SRC[${j}]}.txt continue fi
Test_macro if [ $TESTRES -gt 0 ] then echo $line | sed "s/t_xx/t_macro/" >> xx${SRC[${j}]}.txt continue fi
Test_crisis if [ $TESTRES -gt 0 ] then echo $line | sed "s/t_xx/t_crisis/" >> xx${SRC[${j}]}.txt continue fi
Test_banca if [ $TESTRES -gt 0 ] then echo $line | sed "s/t_xx/t_banca/" >> xx${SRC[${j}]}.txt continue fi
Test_bolsa if [ $TESTRES -gt 0 ] then echo $line | sed "s/t_xx/t_bolsa/" >> xx${SRC[${j}]}.txt continue fi
Test_energia if [ $TESTRES -gt 0 ] then echo $line | sed "s/t_xx/t_energia/" >> xx${SRC[${j}]}.txt continue fi Test_vivienda if [ $TESTRES -gt 0 ] then echo $line | sed "s/t_xx/t_vivienda/" >> xx${SRC[${j}]}.txt continue fi
echo $line >> xx${SRC[${j}]}.txt
done
done
done
for ((j=0;j<$SRC_NUM_ELEMS;j++)); do rm -f zzleft.txt cp xx${SRC[${j}]}.txt zzleft.txt
Otro que se une a los ánimos para aprender expresiones regulares. En mi bitácora he escrito un par de veces acerca de ellas, en un nivel bastante básico. Puede resultar algo complicado, pero la verdad es que te puede ahorrar bastante tiempo en según qué cosas.
Re:Justo a tiempo
(Puntos:2)( http://www.voluntariado.net/ | Última bitácora: Domingo, 10 Junio de 2012, 21:48h )
1) Echar un ojo a la prensa económica cada día, abrir las noticias en pestañas diferentes, y guardarlas con "añadir todas las pestañas abiertas a marcadores" (de lunes a domingo). [20-30 minutos diarios]
2) Exportar los marcadores a html. [5 minutos]
3) Copiar y pegar en ficheros de lunes.txt a domingo.txt [5 minutos]
4) Como base, y sólo para 5 diarios prefijados, ejecuto el script 'genlinks.sh' (que a su vez llama a 'h2s.sh', son muy cutres, pero para lo que es, ya me vale). [1 minuto si lo ejecutas en un Linux, más de 10 si es bajo Cygwin]
5) Recoger entradas de blogs [45 minutos]
6) Recoger índices de tipos de interés, petróleo, y euro/dólar [15 minutos]
7) Revisar y adaptar para Barrapunto [15 minutos]
Código fuente de los scripts (generan porciones de código PHP a partir de los marcadores guardados con Firefox):
<i>h2s.sh <incio></i>
#!/bin/sh
sed "s/<DT>//" | sed "s/[^\"]*<A HREF=\"\([^\"]*\)\"[^\>]*>\([^<]*\)[^\"]*/{\2\|\1
<i>h2s.sh <fin></i>
<i>genlinks.sh <incio></i>
#!/bin/sh
SRC=( 'lunes' 'martes' 'miercoles' 'jueves' 'viernes' 'sabado' 'domingo' )
SRC_NUM_ELEMS=${#SRC[@]}
MEDIOS=( 'eleconomista' 'expansion' 'cotizalia' 'lavanguardia' 'elpais' )
MEDIOS_NUM_ELEMS=${#MEDIOS[@]}
TEMAS=( 't_empleo' 't_macro' 't_crisis' 't_banca' 't_bolsa' 't_energia' 't_vivienda' )
TEMAS_NUM_ELEMS=${#TEMAS[@]}
TESTPARAM=
TE
Test_empleo()
{
Z1=`echo $TESTPARAM | grep -i paro`
Z2=`echo $TESTPARAM | grep -i desempleo`
Z3=`echo $TESTPARAM | grep -i seguridad.social`
Z4=`echo $TESTPARAM | grep -i subsidio`
Z5=`echo $TESTPARAM | grep ERE`
Z6=`echo $TESTPARAM | grep despido`
Z7=`echo $TESTPARAM | grep corbacho`
Z8=`echo $TESTPARAM | grep jubilaci.n`
Z9=`echo $TESTPARAM | grep convenio.colectivo`
ZA=`echo $TESTPARAM | grep empleo`
ZB=`echo $TESTPARAM | grep -i enfermedad | grep -i laboral`
ZC=`echo $TESTPARAM | grep -i parados`
ZD=`echo $TESTPARAM | grep -i pensi.nes`
ZE=`echo $TESTPARAM | grep -i salario`
ZF=`echo $TESTPARAM | grep -i reforma | grep -i laboral`
TESTRES=$((${#Z1}+${#Z2}+${#Z3}+${#Z4}+${#Z5}+${#
}
Test_macro()
{
Z1=`echo $TESTPARAM | grep -i inflaci.n`
Z2=`echo $TESTPARAM | grep -i deflaci.n`
Z3=`echo $TESTPARAM | grep -i euro | grep -i dolar`
Z4=`echo $TESTPARAM | grep -i macroecon`
Z5=`echo $TESTPARAM | grep -i fitch | grep -i espa.a`
Z6=`echo $TESTPARAM | grep -i BCE`
Z7=`echo $TESTPARAM | grep -i Trichet`
Z8=`echo $TESTPARAM | grep -i tesoro | grep -i bono`
Z9=`echo $TESTPARAM | grep -i tesoro | grep -i emisi`
TESTRES=$((${#Z1}+${#Z2}+${#Z3}+${#Z4}+${#Z5}+${#
}
Test_crisis()
{
Z2=`echo $TESTPARAM | grep -i crisis`
Z3=`echo $TESTPARAM | grep -i manifestaci`
Z4=`echo $TESTPARAM | grep -i protesta`
Z5=`echo $TESTPARAM | grep -i confianza | grep -i consum`
Z6=`echo $TESTPARAM | grep -i marca | grep -i blanca`
Z7=`echo $TESTPARAM | grep -i ca.da | grep -i venta`
Z8=`echo $TESTPARAM | grep -i concurso | grep -i acreedor`
TESTRES=$((${#Z1}+${#Z2}+${#Z3}+${#Z4}+${#Z5}+${#
}
Test_banca()
{
Z1=`echo $TESTPARAM | grep -i banco`
Z2=`echo $TESTPARAM | grep -i caja`
Z3=`echo $TESTPARAM | grep -i caixa`
Z4=`echo $TESTPARAM | grep -i morosidad`
Z5=`echo $TESTPARAM | grep -i solvencia`
Z6=`echo $TESTPARAM | grep BBK`
Z7=`echo $TESTPARAM | grep CAM`
Z8=`echo $TESTPARAM | grep BBVA`
Z9=`echo $TESTPARAM | grep RBS`
ZA=`echo $TESTPARAM | grep UBS`
ZB=`echo $TESTPARAM | grep -i euribor`
ZC=`echo $TESTPARAM | grep FROB`
ZD=`echo $TESTPARAM | grep BNP`
TESTRES=$((${#Z1}+${#Z2}+${#Z3}+${#Z4}+${#Z5}+${#
}
Test_bolsa()
{
Z1=`echo $TESTPARAM | grep -i mercados`
Z2=`echo $TESTPARAM | grep -i cotizaci.n`
Z3=`echo $TESTPARAM | grep -i IBEX`
Z4=`echo $TESTPARAM | grep -i burs.til`
Z5=`echo $TESTPARAM | grep -i acciones`
Z6=`echo $TESTPARAM | grep -i bolsa`
Z7=`echo $TESTPARAM | grep -i cotizado`
TESTRES=$((${#Z1}+${#Z2}+${#Z3}+${#Z4}+${#Z5}+${#
}
Test_energia()
{
Z1=`echo $TESTPARAM | grep -i petr.leo`
Z2=`echo $TESTPARAM | grep -i gas | grep -i oducto`
Z3=`echo $TESTPARAM | grep -i nuclear | grep -i energia`
Z4=`echo $TESTPARAM | grep -i opep | grep -i producci.n`
Z5=`echo $TESTPARAM | grep -i barril`
Z6=`echo $TESTPARAM | grep -i crudo`
Z7=`echo $TESTPARAM | grep Brent`
Z8=`echo $TESTPARAM | grep -i west | grep -i texas`
Z9=`echo $TESTPARAM | grep -i gasolina`
ZA=`echo $TESTPARAM | grep -i gasoleo`
ZB=`echo $TESTPARAM | grep -i gasoil`
TESTRES=$((${#Z1}+${#Z2}+${#Z3}+${#Z4}+${#Z5}+${#
}
Tes
{
Z1=`echo $TESTPARAM | grep -i alquiler`
Z2=`echo $TESTPARAM | grep -i vivienda`
Z3=`echo $TESTPARAM | grep -i inmobiliaria`
Z4=`echo $TESTPARAM | grep -i hipotecados`
TESTRES=$((${#Z1}+${#Z2}+${#Z3}+${#Z4}))
}
rm -f xx*\.txt
rm -f zz*\.txt
for ((j=0;j<$SRC_NUM_ELEMS;j++));
do
for ((k=0;k<$MEDIOS_NUM_ELEMS;k++));
do
echo ${SRC[${j}]}. ${MEDIOS[${k}]}
cat tmp.txt | while read line
do
# echo $line
TESTPARAM=$line
Test_empleo
if [ $TESTRES -gt 0 ]
then
echo $line | sed "s/t_xx/t_empleo/" >> xx${SRC[${j}]}.txt
continue
fi
Test_macro
if [ $TESTRES -gt 0 ]
then
echo $line | sed "s/t_xx/t_macro/" >> xx${SRC[${j}]}.txt
continue
fi
Test_crisis
if [ $TESTRES -gt 0 ]
then
echo $line | sed "s/t_xx/t_crisis/" >> xx${SRC[${j}]}.txt
continue
fi
Test_banca
if [ $TESTRES -gt 0 ]
then
echo $line | sed "s/t_xx/t_banca/" >> xx${SRC[${j}]}.txt
continue
fi
Test_bolsa
if [ $TESTRES -gt 0 ]
then
echo $line | sed "s/t_xx/t_bolsa/" >> xx${SRC[${j}]}.txt
continue
fi
Test_energia
if [ $TESTRES -gt 0 ]
then
echo $line | sed "s/t_xx/t_energia/" >> xx${SRC[${j}]}.txt
continue
fi
Test_vivienda
if [ $TESTRES -gt 0 ]
then
echo $line | sed "s/t_xx/t_vivienda/" >> xx${SRC[${j}]}.txt
continue
fi
echo $line >> xx${SRC[${j}]}.txt
done
done
done
for ((j=0;j<$SRC_NUM_ELEMS;j++));
do
rm -f zzleft.txt
cp xx${SRC[${j}]}.txt zzleft.txt
for ((k=0;k<$TEMAS_NUM_ELEMS;k++));
do
grep ${TEMAS[${k}]} zzleft.txt >> zz${SRC[${j}]}.txt
grep -v ${TEMAS[${k}]} zzleft.txt > zzleft2.txt
mv zzleft2.txt zzleft.txt
done
cat zzleft.txt >> zz${SRC[${j}]}.txt
rm -f zzleft.txt
done
<i>genlinks.sh <fin></i>
Re:Justo a tiempo
(Puntos:2)( http://press.asqueados.net/ | Última bitácora: Jueves, 06 Marzo de 2014, 11:47h )
Asqueados [asqueados.net]: mas politica, informatica y payasadas que nunca
Re:Justo a tiempo
(Puntos:1)( http://www.ekinabokatuak.com/ | Última bitácora: Jueves, 22 Febrero de 2018, 07:45h )
Otro que se une a los ánimos para aprender expresiones regulares. En mi bitácora he escrito un par de veces acerca de ellas, en un nivel bastante básico. Puede resultar algo complicado, pero la verdad es que te puede ahorrar bastante tiempo en según qué cosas.
abogado en Errenteria [ekinabokatuak.com]