This software is freeware, but it is not in the public domain. The author retains all rights to the software. You may redistribute this software in its original form provided that you make no profit. YOU MAY NOT translate, reverse engineer, decompile, or disassemble this software or modify the software or its documentation in any way, THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY WARRANTIES AS TO PERFORMANCE, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR ANY OTHER WARRANTIES WHETHER EXPRESSED OR IMPLIED. THE ENTIRE RISK AS TO THE RESULTS AND PERFORMANCE OF THE SOFTWARE IS ASSUMED BY YOU. THE AUTHOR SHALL NOT HAVE ANY LIABILITY TO YOU OR ANY OTHER PERSON OR ENTITY FOR ANY DAMAGES WHATSOEVER, INCLUDING, BUT NOT LIMITED TO, LOSS OF REVENUE OR PROFIT, LOST OR DAMAGED DATA OR OTHER. THE AUTHOR IS ALSO NOT RESPONSIBLE FOR CLAIMS BY A THIRD PARTY. -------------------------------- Trim 1.0 Freeware Copyright(C) 2000, Jem Berkes Download updates from www.pc-tools.net Usage: trim filename x y If filename's length exceeds x bytes, then as many as y lines are removed from the start of the text file. Exit codes: 0=OK, 1=can't open file, 2=can't create temp, 3=can't write to file, 255=syntax. Information messages are sent to stdout (1). Error messages to stderr (2). -------------- I wrote Trim because I needed a way to monitor and control the sizes of logfiles. You can put Trim in a script so that it automatically does this, for example: trim access_log 1000000 100 This command will examine access_log to see if its length is greater than 1000000 bytes. If the file's length exceeds the limit, then Trim will remove 100 lines from the start of the text file. If the file has less than 100 lines in it, then the file will cleared. If you are running Trim in a script, you may want to suppress normal output but keep an eye out for errors. You can accomplish this with: trim filename x y 1>null This redirects stdout (1) to null, leaving stderr active. You can also redirect errors to a file: trim filename x y 2>error.log These stdout/stderr redirections work with Windows NT but may not work with Win95/98/2000.