From: Francois Fleuret Date: Mon, 22 Mar 2010 20:39:21 +0000 (+0100) Subject: Removed the compression of the archive. X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?p=scripts.git;a=commitdiff_plain;h=069e747edd8ffb87b66c839e08812d30c4675b8a Removed the compression of the archive. --- diff --git a/gma.sh b/gma.sh index ae7bdcd..6d25f0f 100755 --- a/gma.sh +++ b/gma.sh @@ -35,11 +35,20 @@ if [[ $1 ]]; then exit 1 fi - if [[ $2 ]]; then - FILE_PATTERN="${MAIL_ARCHIVE_DIR}/${2}/*/*gz" - SIZE=$(\dus ${MAIL_ARCHIVE_DIR}/${2} | cut -f 1 -d" ") + shift + + HEADER_ONLY="-H" + + if [[ $1 == "--body" ]]; then + HEADER_ONLY="" + shift + fi + + if [[ $1 ]]; then + FILE_PATTERN="${MAIL_ARCHIVE_DIR}/${1}/*/*" + SIZE=$(\dus ${MAIL_ARCHIVE_DIR}/${1} | cut -f 1 -d" ") else - FILE_PATTERN="${MAIL_ARCHIVE_DIR}/*/*/*gz" + FILE_PATTERN="${MAIL_ARCHIVE_DIR}/*/*/*" SIZE=$(\dus ${MAIL_ARCHIVE_DIR}/ | cut -f 1 -d" ") fi @@ -49,9 +58,8 @@ if [[ $1 ]]; then cat ${FILE_PATTERN} \ | pv -s ${SIZE} -p -t -e - \ - | zcat \ - | mboxgrep -i "$1" \ - | mboxgrep -v '^Subject:.*SPAM' > ${RESULT_MBOX} + | mboxgrep ${HEADER_ONLY} -i "${PATTERN}" \ + | mboxgrep ${HEADER_ONLY} -v '^Subject:.*SPAM' > ${RESULT_MBOX} echo "Found "$(grep ^"From " ${RESULT_MBOX} | wc -l)" messages." else