LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 09-13-2008, 03:39 PM   #1
scjohnie
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
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

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


Reply


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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:15 AM.

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