From 069e747edd8ffb87b66c839e08812d30c4675b8a Mon Sep 17 00:00:00 2001 From: Francois Fleuret Date: Mon, 22 Mar 2010 21:39:21 +0100 Subject: [PATCH] Removed the compression of the archive. --- gma.sh | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) 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 -- 2.39.5