Zero out a file unix




















Registered User. Join Date: Oct And always giving the below messages-- bash Although the above messages stops but wtmpx grows more faster than file 'messages'. So, far i know 'wtmpx' files logs the user access. But i don't know how to implement the script. Could anyone help me??

Cheers purple. Do a cat wtmpx wc -l to count the lines and then decide how many lines you should delete to shrink the file size sufficiently.

Hi soliberus, I tried to delete first lines of file messages with command sed '1,d' messages. But it is not working.

Please see below. So, i plan to delete only lines from 'messages' bash Ooops, I didn't give you the full script. Originally Posted by soliberus. Join Date: Mar I got a solution for overgrowing wtmpx. Below is the line need to put in cronjob.

Although i am using solaris 9 but hope line should work it also. This command makes sense as it is using standard UNIX redirection to place the contents of one file a known empty one to another file.

Another way to do this, although a less obvious way and probably less readable in a shell script by others, is. Your participation helps us to help others. By visiting this site, users agree to our disclaimer. Very little of this answer actually is relevant to or answers the question.

There is a time and a place for everything. Your information may be useful in some other context but it does not belong here - you should find a more appropriate place for it because nobody trying to rotate logs is going to look in this completely unrelated redirection question. Here your answer is the equivalent of a digital weed, just as an otherwise useful pumpkin plant in the middle of a cornfield would be considered a weed.

There are many ways to zero-out a file. I think KM. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Podcast Making Agile work for data science. Stack Gives Back Featured on Meta.

New post summary designs on greatest hits now, everywhere else eventually. Linked Related Hot Network Questions. Question feed. Accept all cookies Customize settings.

This is probably obvious, but Google seems to have let me down. I need to create a zero byte file with arbitrary names on Unix AIX, ksh. What is a good command that will do this.

Something I can script obviously. Just to be clear Im not doing anything stupid. This is a script to generate certain testing scenarios. Checking proper behavior when handling 0-byte files. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow.



0コメント

  • 1000 / 1000