home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.shell
- Path: sparky!uunet!mcsun!sunic!aun.uninett.no!news.uit.no!ugle.unit.no!news
- From: Harald.Eikrem@delab.sintef.no
- Subject: Re: How to empty a file
- In-Reply-To: ltaylor@blinky.East.Sun.COM's message of 26 Aug 1992 14:31:39 GMT
- Message-ID: <1992Aug26.172228*Harald.Eikrem@delab.sintef.no>
- Sender: news@ugle.unit.no (NetNews Administrator)
- Organization: SINTEF DELAB, Trondheim, Norway.
- References: <17g4kbINN4bm@seven-up.East.Sun.COM>
- Date: 26 Aug 92 17:22:28
- Lines: 20
-
- ! >> I'd like to empty a log file after extracting what I need from it so that
- ! >> the next day's data can fill it up a-fresh. The file must exist after
- ! >> emptying it.
- !
- ! cp /dev/null <logfile>
- !
- ! /laura
-
- This is definitely a FAQ. My favourite file making/nulling command is:
-
- : > file
-
- which should work from any kind of shell (in csh "noclobber" must be
- neutralised). This construct does not depend on
-
- 1) another program (cp, cat, ...)
- 2) /dev/null
-
-
- ~~harald E.
-