From owner-freebsd-questions Mon Aug 21 12:36:18 2000 Delivered-To: freebsd-questions@freebsd.org Received: from mailgw00.execpc.com (mailgw00.execpc.com [169.207.1.78]) by hub.freebsd.org (Postfix) with ESMTP id C533937B424 for ; Mon, 21 Aug 2000 12:36:15 -0700 (PDT) Received: from judah (d48.as2.appl.wi.voyager.net [169.207.24.48]) by mailgw00.execpc.com (8.9.1) id OAA28887; Mon, 21 Aug 2000 14:35:59 -0500 From: "Doug Poland" To: "Murray's Listserv Account" , Subject: RE: how to clip&email last lines of log file Date: Mon, 21 Aug 2000 14:35:59 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) In-Reply-To: <20000821132811.A730@converging.net> X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 Importance: Normal Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > > I have written a .sh script and use cron to email a log file to > my email account > on a daily basis. I could easily delete the previous day's log account > before the current day's log is created but I wish to have a > historical account of the log. Alternatively, I could create two logs: > running and daily and delete the daily... But, I started thinking > about clipping the last lines of a log and emailing the last lines. > For example, the log entries for each day are only 6 lines each. How > do you clip lines from a file. The .sh scripts are run as root and > root uses the csh shell. I do not have the perl port installed. Is > there a shell script/command that would do the job? > Easy with tail, i.e., you want the last 5 lines from /var/log/messages... tail -5 /var/log/messages | mail me Regards, Doug > Reply-To: > -- > Murray Davis > Converging Technology Solutions > Edmonton, AB > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message