bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug#467378: coreutils: Please include a program to truncate files


From: Russell Coker
Subject: Re: Bug#467378: coreutils: Please include a program to truncate files
Date: Tue, 26 Feb 2008 22:32:45 +1100
User-agent: KMail/1.9.5

On Tuesday 26 February 2008 21:03, Pádraig Brady <address@hidden> wrote:
> > That depends on your definition of "works".
> > If you don't mind retaining the first 2GiB of content in
> > a preexisting output file, then it works fine.  But the initial
> > truncation is required if you want to be sure it's a big sparse
> > file with nothing but NUL bytes.
> >
> > Try this:
> >
> >     echo foo > k
> >     dd bs=1 seek=2G of=k < /dev/null
> >     head -c4 k
> >
> > and note that it prints "foo\n".
>
> That's how I would expect it to work,
> and is how I'm currently implementing it.
> Given the name "truncate" I think this
> operation should be obvious to users.

What exactly do you mean by "how I expect it to work", do you mean "reducing 
the file size" or "removing all content and extending it to size N"?  The 
latter is not truncation, it's replacement.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]