LinuxAnswers - the LQ Linux tutorial section.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 09-13-2008, 03:39 PM   #1
LQ Newbie
Registered: Sep 2008
Posts: 1

Rep: Reputation: 0
Question 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
Old 09-13-2008, 08:51 PM   #2
LQ Guru
Registered: Jan 2001
Posts: 24,147

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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Looking for a shell script that prints a file only if it has more than 10 lines djfog Linux - Newbie 8 07-01-2008 12:23 PM
Shell Script: Delete lines til string found or until particular string. bhargav_crd Linux - General 3 12-20-2007 11:14 PM
shell script for expanding lines in a file b123coder Programming 1 05-25-2006 04:51 AM
shell script to copy lines from a file Warmduvet Programming 2 09-14-2004 09:25 PM
Can't get lines of a file with a Bash script.. barisdemiray Programming 2 08-11-2004 12:42 PM

All times are GMT -5. The time now is 03:49 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration