From owner-freebsd-questions@FreeBSD.ORG Mon Jun 22 00:56:28 2015 Return-Path: Delivered-To: freebsd-questions@nevdull.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8FA506F7 for ; Mon, 22 Jun 2015 00:56:28 +0000 (UTC) (envelope-from listmgr@antennex.com) Received: from BAY004-OMC2S5.hotmail.com (bay004-omc2s5.hotmail.com [65.54.190.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (Client CN "*.outlook.com", Issuer "MSIT Machine Auth CA 2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 785CD2DA for ; Mon, 22 Jun 2015 00:56:27 +0000 (UTC) (envelope-from listmgr@antennex.com) Received: from BAY404-EAS352 ([65.54.190.123]) by BAY004-OMC2S5.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.22751); Sun, 21 Jun 2015 14:32:08 -0700 X-TMN: [LdHs5fVwu6MGn90M6rVhWWiZf4BVKyRpCmswc5/78DM=] X-Originating-Email: [listmgr@antennex.com] Message-ID: From: "Lt. Commander" To: "'Patrick Hess'" , References: <20150615015516.b3ea7633.freebsd@edvax.de> <2609852.Pc7nSdcYla@desk8.phess.net> In-Reply-To: <2609852.Pc7nSdcYla@desk8.phess.net> Subject: RE: Script question Date: Sun, 21 Jun 2015 16:32:04 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 15.0 Thread-Index: AQABAgME0X1Dm5rl1ITbGRHvuqm5ZwDmqqb4AImG+awAOb+0/QChWiN0ACr4FWoAANHiZwBu370yAH5eu84A9Ixn/aE0ACJA Content-Language: en-us X-OriginalArrivalTime: 21 Jun 2015 21:32:08.0243 (UTC) FILETIME=[B9CBD030:01D0AC69] 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, 22 Jun 2015 00:56:28 -0000 To: freebsd-questions@freebsd.org Subject: Re: Script question 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 _______________________________________________ Hi list! The script guys were very helpful in smoothing out my sh shell script and it with other script calls are doing the job I needed. BUT! I took the snippet below to use as an "yes/no" intro to one of the calls. It must have aged as is because it complains about badly placed "()s" right near the top of the intro and I suspect it won't agree with another line further down either. Perhaps a hint from the experts as to how to change the problem? Thank you! Jason