Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 8 Dec 2003 23:41:32 -0500
From:      "Matt Emmerton" <matt@gsicomp.on.ca>
To:        "Dan Nelson" <dnelson@allantgroup.com>, "Kevin D. Kinsey, DaleCo, S.P." <kdk@daleco.biz>
Cc:        Harald Schmalzbauer <h@schmalzbauer.de>
Subject:   Re: a technical how to
Message-ID:  <000e01c3be0e$b8774670$1200a8c0@gsicomp.on.ca>
References:  <20031209015125.74977.qmail@web14806.mail.yahoo.com><200312090259.23677@harrymail> <3FD54A37.8050503@daleco.biz> <20031209043046.GC2435@dan.emsphone.com>

next in thread | previous in thread | raw e-mail | index | archive | help
> In the last episode (Dec 08), Kevin D. Kinsey, DaleCo, S.P. said:
> > Harald Schmalzbauer wrote:
> > >On Tuesday 09 December 2003 02:51, homeyra g wrote:
> > >>So, I hope this is the right address for this type of question. If
> > >>not would you please forward this and/or let me know the correct
> > >>address.
> > >>
> > >>Thanks,
> > >>
> > >>Here is the question: How to truncate a file from the begining to a
> > >>certain point in the file?
>
> If you're writing a script, use the /usr/bin/truncate command.  If
> you're writing a C program, use the truncate() function.

truncate() essentially alters the "end-of-file" position, by decreasing it
(truncating the file) or increasing it (extending the file.)

I think what the requestor wants is a way to adjust the "start-of-file"
position, which would effectively "truncate [sic] a file from the beginning
to a certain point in the file".

One way to accomplish this is as follows:

split -b 1024 /path/to/data
rm <files that represent data to "truncate">
cat * > data.new

--
Matt Emmerton



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?000e01c3be0e$b8774670$1200a8c0>