Okin Posted April 12, 2006 Share Posted April 12, 2006 Bonjour, Je souhaite savoir si sous linux une commande existe pour vider un .log ou .txt sans effacer le fichier lui meme, le vider entierement quoi ... J'ai chercher sur google bien entendu, mais je tombe sur le "vidage" de mémoire system et autre ... Quelqu'un a une idée ? Merci ;o) Link to comment Share on other sites More sharing options...
tuxbubling Posted April 12, 2006 Share Posted April 12, 2006 Bonjour, Je souhaite savoir si sous linux une commande existe pour vider un .log ou .txt sans effacer le fichier lui meme, le vider entierement quoi ... J'ai chercher sur google bien entendu, mais je tombe sur le "vidage" de mémoire system et autre ... Quelqu'un a une idée ? Merci ;o) echo "" > tonfichier.log et voila ^^ Link to comment Share on other sites More sharing options...
naparuba Posted April 12, 2006 Share Posted April 12, 2006 Mais le echo "" > vas pas mettre un "\n" justement? Et un cp /dev/null > tonfichier ? (ça on est sûr que c'est vide ) Link to comment Share on other sites More sharing options...
nonas Posted April 12, 2006 Share Posted April 12, 2006 On ne cp pas /dev/null, on le cat. cat /dev/null > ton fichier et ça marche Link to comment Share on other sites More sharing options...
tuxbubling Posted April 12, 2006 Share Posted April 12, 2006 Mais le echo "" > vas pas mettre un "\n" justement? Et un cp /dev/null > tonfichier ? (ça on est sûr que c'est vide ) echo -n "" > tonlog Link to comment Share on other sites More sharing options...
astero-H Posted April 12, 2006 Share Posted April 12, 2006 Ou alors : echo -n "" > ton_fichier Le -n pour éviter le saut de ligne Ou bien encore : kate ton_fichier [ctrl] A, [suppr] edit : toasted Link to comment Share on other sites More sharing options...
naparuba Posted April 12, 2006 Share Posted April 12, 2006 On ne cp pas /dev/null, on le cat. cat /dev/null > ton fichier et ça marche Ah oui Link to comment Share on other sites More sharing options...
Sandeman Posted April 12, 2006 Share Posted April 12, 2006 z'êtes ben compliqués > ton_fichier tout court :) sinon rm ton_fichier && touch ton_fichier Link to comment Share on other sites More sharing options...
naparuba Posted April 12, 2006 Share Posted April 12, 2006 z'êtes ben compliqués > ton_fichier tout court :) sinon rm ton_fichier && touch ton_fichier Bien le premiere en effet, sinon le second c'est triché Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.