[SunHELP] Shell Script

sunhelp at sunhelp.org sunhelp at sunhelp.org
Mon Mar 26 13:35:46 CST 2001


--openmail-part-39d4ca95-00000001
Content-Type: text/plain; charset=US-ASCII
Content-Disposition: inline
	;Creation-Date="Mon, 26 Mar 2001 13:35:45 -0600"
Content-Transfer-Encoding: 7bit

>From what you said, you need to keep the files around, and they should 
only have the last 100 lines in them. Assuming the need no backup, 
typing the following should work:
ksh
for i in `find /path -name "*.log" -o -name "*.txt"`;do
tail -100 $1 > /tmp/$i.tmp
mv /tmp/$i.tmp $i
done

-----Original Message-----
From: balaji.iii [mailto:balaji_iii at hotmail.com]
Sent: Monday, March 26, 2001 8:18 AM
To: sunhelp
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

--openmail-part-39d4ca95-00000001--




More information about the SunHELP mailing list