From owner-freebsd-questions@FreeBSD.ORG Mon Jun 15 00:39:27 2015 Return-Path: Delivered-To: freebsd-questions@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AA26C86B for ; Mon, 15 Jun 2015 00:39:27 +0000 (UTC) (envelope-from jd1008@gmail.com) Received: from mail-ie0-x22b.google.com (mail-ie0-x22b.google.com [IPv6:2607:f8b0:4001:c03::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6C3931E6 for ; Mon, 15 Jun 2015 00:39:27 +0000 (UTC) (envelope-from jd1008@gmail.com) Received: by iecrd14 with SMTP id rd14so21419874iec.3 for ; Sun, 14 Jun 2015 17:39:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=hMCkZqAq+GJSNES4A+cfwk1WdP9EsRMP9xnpPEP7aXE=; b=FpcNx+JVxxBMtDUqnK9Q7866um4Lqnww5fZZh4e/Z/BFBLlxLh2NA1k5oBwV+M537N wAXQw+xPxziY/Yzp/y8+SMSWiJOtZ3pnFMfKCQZggaKzFWrbBaoUUzn49Su8ySBUP7SP cvk8nTvrOgEfXm1QhmngPGqL0g75MaArfoQtiHAcc+khm5qJaILAImd3gFzuUkpsPj9V 4oLcr1cHFzTa2Jjpg1lHLbJSoGV+BjNAf4ZqSJqkEw4DMAoQvhA3h1/xLzpMdX/UOaPL RX5aRjh28z7kYp1lnad2tAnX06Pk8k90Xn880lbw6EhPZV9+1sctOhReRHfZJEYzHjKE 7ehg== X-Received: by 10.107.19.104 with SMTP id b101mr31750488ioj.39.1434328766628; Sun, 14 Jun 2015 17:39:26 -0700 (PDT) Received: from localhost.localdomain ([50.243.6.59]) by mx.google.com with ESMTPSA id s5sm6473811igh.6.2015.06.14.17.39.25 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 14 Jun 2015 17:39:25 -0700 (PDT) Message-ID: <557E1EA7.3080507@gmail.com> Date: Sun, 14 Jun 2015 18:39:03 -0600 From: jd1008 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: freebsd-questions@freebsd.org Subject: Re: Script question References: <20150615015516.b3ea7633.freebsd@edvax.de> <2609852.Pc7nSdcYla@desk8.phess.net> In-Reply-To: <2609852.Pc7nSdcYla@desk8.phess.net> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Jun 2015 00:39:27 -0000 On 06/14/2015 06:27 PM, Patrick Hess wrote: > Polytropon wrote: >> Or if you want to omit the grep call: >> >> awk '/spam=YES/ {print $11}' /var/log/maillog | sort | uniq | sed -e 's/^.*=//' > /tmp/spam-ip.txt >> >> And then continue: >> >> cat /tmp/spam-ip.txt >> /usr/samba/mail/envelope >> cat /tmp/spam-ip.txt | mail -s "SPAM IPs...." us.navy@outlook.com >> >> Finally, you can easily remove /tmp/spam-ip.txt. > You could even take this one step further and eliminate the need for > a temporary file altogether by making use of tee(1): > > awk '/spam=YES/ {print $11}' /var/log/maillog | > sort | > uniq | > sed -e 's/^.*=//' | > tee -a /usr/samba/mail/envelope | > mail -s "SPAM IPs...." us.navy@outlook.com > > Patrick > _ Patrik, you forgot to add the continuation \ at end of you lines. The Commander will not be able to use this as it stands.