[gull] Tronquer des fichiers log
Félix Hauri
felix at f-hauri.ch
Mon Jan 3 16:49:07 CET 2011
On Mon, Jan 03, 2011 at 04:37:33PM +0100, Christian Grigis wrote:
> Apparemment il y a 'truncate' dans les GNU coreutils.
Tiens!?
Etrange: ``Y'a pas dans mon desktop''.
Ok: Je suis sous Debian Lenny (5.0), cette commande est fournie
dans les ``Core Utils'' de Debian Squeeze (6.0 à venir) et
dans Ubuntu (karmic, en tout cas).
>
> % truncate -s 100k *.log
>
> ... qui utilise bien, vérification faite, l'appel système
> correspondant. :)
Oui, mais attention!
$ man truncate
truncate - shrink or extend the size of a file to the specified size
Shrink *or* extend!!!
Et donc:
If a FILE is larger than the specified size, the extra data is lost.
If a FILE is shorter, it is extended and the extended part reads as zero bytes.
Bref, ce n'est probablement pas ce que tu cherches...
--
Félix Hauri - <felix at f-hauri.ch> - http://www.f-hauri.ch
More information about the gull
mailing list