LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Need a bash shell script which will delete lines from file (http://www.linuxquestions.org/questions/linux-newbie-8/need-a-bash-shell-script-which-will-delete-lines-from-file-669741/)

scjohnie 09-13-2008 04:39 PM

Need a bash shell script which will delete lines from file
 
I have an Apache WEB server which has a very limited space for logging connections. Monitor software polls the web server every 30 seconds from the same IP address. This causes 2 entries per minute.

I would like to have a shell script run as a cron job daily to:
1. Scan the log file for the IFS field with the monitor machines IP address.
2. Delete all entries from this machine in the log file.
3. IF the log file is missing the shell script will exit.
I've been playing with shell scripts, but cannot seem to find a workable script to accomplish this task

trickykid 09-13-2008 09:51 PM

Sounds like a job for logrotate which is literally installed by default on every distribution I've ever used.


All times are GMT -5. The time now is 09:29 AM.