[SunHELP] Shell Script

Warren Brennan sunhelp at sunhelp.org
Mon Mar 26 13:23:11 CST 2001


There may be a better way, but you could do something like:

#!/usr/bin/ksh

LOG_DIR=/directory

for FILE in $( ls -1 ${LOG_DIR}/*.log ) ; do

	tail -100 $FILE > ${FILE}.tmp
	mv ${FILE}.tmp $FILE

done



> -----Original Message-----
> From:	Balaji N [SMTP:balaji_iii at hotmail.com]
> Sent:	Monday, March 26, 2001 9:18 AM
> To:	sunhelp at sunhelp.org
> Subject:	[SunHELP] Shell Script
> 
> Hi everyone
> 
> I have a directory which contains *.log files and txt files. I need a
> shell  script which  can clear all lines in *.log files and keeping some
> latest 100 lines . I can put the script as cron job, so that it can
> run in weekly basis. can anyone have?
> 
> Thanks in advance
> Balaji
> 
> _________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
> 
> _______________________________________________
> SunHELP maillist  -  SunHELP at sunhelp.org
> http://www.sunhelp.org/mailman/listinfo/sunhelp



More information about the SunHELP mailing list