[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug#467378: coreutils: Please include a program to truncate files
From: |
Pádraig Brady |
Subject: |
Re: Bug#467378: coreutils: Please include a program to truncate files |
Date: |
Tue, 26 Feb 2008 10:03:41 +0000 |
User-agent: |
Thunderbird 2.0.0.6 (X11/20071008) |
Jim Meyering wrote:
> Paul Eggert <address@hidden> wrote:
>> Jim Meyering <address@hidden> writes:
>>> If you don't mind truncating first, how about this?
>>>
>>> true > /var/spool/whatever/foo
>>> dd bs=1 seek=2G of=/var/spool/whatever/foo < /dev/null
>> Also, the latter command works even if the former command is omitted.
>> That is, by itself, that invocation of dd resizes
>> /var/spool/whatever/foo to 2 GiB, discarding or extending the file as
>> needed, which is what the original request asked for.
>
> Hi Paul,
>
> 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.
Pádraig.
p.s. I'm going to push the "timeout" and "truncate"
utils to util-linux-ng/misc-utils/ via Karel Zak
within the next couple of days.
- Re: Bug#467378: coreutils: Please include a program to truncate files, Jim Meyering, 2008/02/25
- Re: Bug#467378: coreutils: Please include a program to truncate files, Pádraig Brady, 2008/02/25
- Re: Bug#467378: coreutils: Please include a program to truncate files, Russell Coker, 2008/02/25
- Re: Bug#467378: coreutils: Please include a program to truncate files, Jim Meyering, 2008/02/25
- Re: Bug#467378: coreutils: Please include a program to truncate files, Russell Coker, 2008/02/25
- Re: Bug#467378: coreutils: Please include a program to truncate files, Jim Meyering, 2008/02/25
- Re: Bug#467378: coreutils: Please include a program to truncate files, Paul Eggert, 2008/02/25
- Re: Bug#467378: coreutils: Please include a program to truncate files, Russell Coker, 2008/02/25
- Re: Bug#467378: coreutils: Please include a program to truncate files, Jim Meyering, 2008/02/26
- Re: Bug#467378: coreutils: Please include a program to truncate files,
Pádraig Brady <=
- Re: Bug#467378: coreutils: Please include a program to truncate files, Russell Coker, 2008/02/26
- Re: Bug#467378: coreutils: Please include a program to truncate files, Pádraig Brady, 2008/02/26