shell-script-pt
[Top][All Lists]
Advanced

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

Script para download de mensagens da lista [atualizado]


From: SuSE List
Subject: Script para download de mensagens da lista [atualizado]
Date: Sun, 04 Sep 2005 18:16:49 -0300
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

Pessoal,

A um tempo atrás eu peguei o script do Marcelo G Dias aqui na lista pra 
tentar baixar as mensagens do grupo....acabei fazendo uma modificações 
nele e segue novamente aqui:

Uso:
msptst2:/home/vinicius/lista # ./lista.sh 1 1000 
http://br.groups.yahoo.com/group/shell-script shell-script

#! /bin/bash
##############################################
# Script Original: Marcelo G. Dias
#
# Alterado por: Marcus Vinicius P Coimbra
# e-mail: <address@hidden>
# Data: 04/09/2005
#
# lista.sh
#
##############################################
erro=0
if [ "$1" = "" -o "$2" = "" -o "$3" = "" -o "$4" = "" ]
then
        echo "Erro -> Uso: $0 num_msg_inicial num_msg_final url apelido"
        erro=1
fi

if [ "$erro" -ne 0 ]
then
        exit $erro
fi

i="$1"
f="$2"
lista="$3"
apelido="$4"

while [ "$i" -le "$f" ]
do
      wget "$lista"/messages/"$i"?expand=1
      i=`expr "$i" + 30`
done

for i in `ls *\?expand\=1`
do
      j=`echo $i | awk -F"?" '{print $1}'`
      if [ $j -lt 10 ]
      then
        num="0000$j"
        html2text "$i" > "$apelido"_"$num".txt
      elif [ $j -lt 100 ]
      then
        num="000$j"
        html2text "$i" > "$apelido"_"$num".txt
      elif [ $j -lt 1000 ]
      then
        num="00$j" ;
        html2text "$i" > "$apelido"_"$num".txt
      elif [ $i -lt 10000 ]
      then
        num="0$j"
        html2text "$i" > "$apelido"_"$num".txt
      fi
done

rm -f *expand*

##############################################
# Fim do script
##############################################

msptst2:/home/vinicius/lista # ls -l shell-script_00*
-rw-r--r--  1 root root 104787 2005-09-04 18:11 shell-script_00001.txt
-rw-r--r--  1 root root  87971 2005-09-04 18:11 shell-script_00031.txt
-rw-r--r--  1 root root  83342 2005-09-04 18:11 shell-script_00061.txt
-rw-r--r--  1 root root  90210 2005-09-04 18:12 shell-script_00091.txt
-rw-r--r--  1 root root  90480 2005-09-04 18:11 shell-script_00121.txt
-rw-r--r--  1 root root  96827 2005-09-04 18:11 shell-script_00151.txt
-rw-r--r--  1 root root  72900 2005-09-04 18:11 shell-script_00181.txt
-rw-r--r--  1 root root  64811 2005-09-04 18:11 shell-script_00211.txt
-rw-r--r--  1 root root 136792 2005-09-04 18:12 shell-script_00241.txt
-rw-r--r--  1 root root 102348 2005-09-04 18:11 shell-script_00271.txt


[]s

Vinny


[As partes desta mensagem que não continham texto foram removidas]



reply via email to

[Prev in Thread] Current Thread [Next in Thread]