[comp.unix.xenix.sco] Emptying a file

ghong@sdcc13.ucsd.edu (Gary) (01/08/91)

There is an easier way of emptying a file which is much simplier
than the solutions that I have seen so far.  Just use:

touch <filename>

where <filename> is the name of the file.  Note that the time/date
stamp on the file will be altered.

Gary Hong

kreed@telesys.cts.com (Kevin W. Reed) (01/09/91)

ghong@sdcc13.ucsd.edu (Gary) writes:

>There is an easier way of emptying a file which is much simplier
>than the solutions that I have seen so far.  Just use:

>touch <filename>

HUH???  This is Not True.

>where <filename> is the name of the file.  Note that the time/date
>stamp on the file will be altered.

By touch(ing) a file, ALL you do is change the date/time stamp of the
file.

From the manual:

     Name
	  touch	- Updates access and modification times	of a file.

     Syntax
	  touch	[ -amc ] [ mmddhhmm[yy]	] files

     Description
	  touch	causes the access and modification times of each
	  argument to be updated.  If no time is specified (see
	  date(C)) the current time is used.  The first	mm refers to
	  the month, dd	refers to the day, hh refers to	the hour, the
	  second mm refers to the minute, and yy refers	to the year.
	  The -a and -m	options	cause touch to update only the access
	  or modification times	respectively (default is -am).	The -c
	  option silently prevents touch from creating the file	if it
	  did not previously exist.

You could use touch to CREATE a file that doesn't exist, but not empty
an existing one.

>Gary Hong

-- 
Kevin W. Reed --- TeleSys Development Systems -- PO 17821, San Diego, CA 92177
TeleSys-II BBS & telesys.UUCP 619-483-3890 ----- Telebit PEP Line 619 483 0965
UUCP: {nosc,ucsd}!crash!telesys!kreed -------- Internet: kreed@telesys.cts.com