Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Jun 2004 15:45:40 -0400
From:      Gerard Samuel <fbsd-questions@trini0.org>
To:        freebsd-questions@freebsd.org
Cc:        Bill Moran <wmoran@potentialtech.com>
Subject:   Re: Means of trimming files
Message-ID:  <200406291545.40422.fbsd-questions@trini0.org>
In-Reply-To: <20040629130702.4116ec60.wmoran@potentialtech.com>
References:  <200406291301.36285.fbsd-questions@trini0.org> <20040629130702.4116ec60.wmoran@potentialtech.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tuesday 29 June 2004 01:07 pm, Bill Moran wrote:
> Gerard Samuel <fbsd-questions@trini0.org> 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



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