Trim

Trim project removes a number of lines from the beginning of a file.
Download

Trim Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Freeware
  • Price:
  • FREE
  • Publisher Name:
  • Jem Berkes
  • Publisher web site:
  • http://www.pc-tools.net/unix/spamtestbuddy/

Trim Tags


Trim Description

Trim project removes a number of lines from the beginning of a file. Trim project removes a number of lines from the beginning of a file.Utility used to monitor and control the sizes of (log) files. Examines a text file to see if its length has exceeded a certain limit; if it has, Trim removes a certain number of lines from the beginning of the file. Ideal for use in crontab.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 originally wrote the 'trim' utility because I needed something in mycrontab that would monitor the sizes of growing log files, and trim thefiles when they grew too large.trim access_log 1000000 100This command will examine access_log to see if its length is greaterthan 1000000 bytes. If the file's length exceeds the limit, then Trimwill remove 100 lines from the start of the text file.If you are running Trim in a script, you may want to suppress normaloutput but keep an eye out for errors. You can accomplish this with:trim filename x y 1>nullThis redirects stdout (1) to null, leaving stderr active. You can alsoredirect errors to a file:trim filename x y 2>error.log


Trim Related Software