Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Nov 2001 16:46:51 -0600
From:      Christopher Farley <chris@northernbrewer.com>
To:        Tony <tony@idk.com>
Subject:   Re: removing last line
Message-ID:  <20011127164649.A92146@northernbrewer.com>
In-Reply-To: <200111272155.NAA08579@idk.com>; from tony@idk.com on Tue, Nov 27, 2001 at 01:55:43PM -0800
References:  <200111272155.NAA08579@idk.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Tony (tony@idk.com) wrote:

> I need a way of removing just the last line in a text file using a csh
> script.
> 
> Any ideas?

#!/bin/csh
set count = `cat $1 | wc -l`;
@ newcount = $count - 1;
head -n $newcount $1

-- 
Christopher Farley
www.northernbrewer.com

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011127164649.A92146>