From owner-freebsd-questions@FreeBSD.ORG Tue Jun 29 19:45:53 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CD78016A4CE for ; Tue, 29 Jun 2004 19:45:53 +0000 (GMT) Received: from rwcrmhc11.comcast.net (rwcrmhc11.comcast.net [204.127.198.35]) by mx1.FreeBSD.org (Postfix) with ESMTP id B63F543D1F for ; Tue, 29 Jun 2004 19:45:53 +0000 (GMT) (envelope-from fbsd-questions@trini0.org) Received: from hivemind.trini0.org (trini0.org[65.34.205.195]) by comcast.net (rwcrmhc11) with ESMTP id <200406291945410130053q7se>; Tue, 29 Jun 2004 19:45:41 +0000 Received: from gladiator.trini0.org (gladiator.trini0.org [192.168.0.3]) by hivemind.trini0.org (Postfix) with ESMTP id 92ED816C; Tue, 29 Jun 2004 15:45:40 -0400 (EDT) From: Gerard Samuel To: freebsd-questions@freebsd.org Date: Tue, 29 Jun 2004 15:45:40 -0400 User-Agent: KMail/1.6.2 References: <200406291301.36285.fbsd-questions@trini0.org> <20040629130702.4116ec60.wmoran@potentialtech.com> In-Reply-To: <20040629130702.4116ec60.wmoran@potentialtech.com> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200406291545.40422.fbsd-questions@trini0.org> cc: Bill Moran Subject: Re: Means of trimming files X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jun 2004 19:45:53 -0000 On Tuesday 29 June 2004 01:07 pm, Bill Moran wrote: > Gerard Samuel wrote: > > When editing php files, via the command line, there is a newline > > character after the closing ?> > > Im looking for a command that would trim files, so that I can append it > > to the find command. > > > > find ./ -name '*.php' -exec SOME_COMMAND {} \; > > If you're absolutely sure of the number of characters you're removing from > the end of the file, you could use truncate(1). > > Otherwise, you'll probably want sed or perl to check that it's not removing > important characters. Trying to use truncate is not working on my end. Does anyone see a syntax error with it??? Ran on 5.2.1-RELEASE-p6 FreeBSD. $ pwd /usr/home/gsam $ ls ~/z.php /home/gsam/z.php $ truncate -r ~/z.php usage: truncate [-c] -s [+|-]size[K|M|G] file ... truncate [-c] -r rfile file ... I tried $ truncate -r rfile ~/z.php but that didn't work either. Thanks