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

Re: truncating files

In article <Pine.LNX.3.96.971206153736.6110A-100000@rn120056.wcu.edu>,
Carl Mummert <mummert@cs.wcu.edu> wrote:
>Is there already a (standard) utility on a linux box to truncate a
>file to 0 bytes?  [Besides echo -n "" > foo, which is 1) too long for
>my lazy fingers and 2) won't take multiple filenames ]

Yeah, just use

	> filename

eg, the null command. If you find this unreadable you can also use

	: > filename

>Since I couldn't find one, I wrote a little C program to do it, but I
>am still interested in whether there is already one on the system.

Multiple filenames? for i in *; do : > $i; done

 Miquel van Smoorenburg |  Studying to be a technomage   <*>
    miquels@cistron.nl  | "May you live in interesting times"

TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-user-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .

Reply to: