
May 4th, 2003, 10:36 PM
|
|
Junior Member
|
|
Join Date: Apr 2003
Posts: 4
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
shell script that reads a file
Hi all!!
I am totally new to shell scripting.
I need a korn shell script that will monitor a log file (shown below). It should scan the log file for distinct ip addresses. When the log file is deleted or a new file is created, the shell script should detect that.
For example, if at 11:00 pm the shell script detects 20 distinct ip addresses, and if at 11:10 the log file is deleted and a new one is created, then when we execute the script at 11:15, the shell script should return all the ip addresses (20 + the ip addresses from new file).
Therefore, the shell script should finally give the number of current ip addresses (distinct) at the end. To make things more clear, this script is used to track the number of current users using a server.
A snippet of log file is as shown below. 333.333.333.333 is the ip address. ip addresses are always preceded by the word AAD@.
------------------
10:54:11 [crelay_child-106762-0]: Reading local IPC message...
10:54:11 [crelay_child-106762-0]: Writing 220 bytes : LOGIN_MSG_RSP[-726510107](1)
URL->AAD@333.333.333.333
10:54:12 [crelay_child-106762-0]: Scheduled send message to client on sfd 5
------------------
Sorry if this is a tough question. Your help will be greatly appreciated.
Thanks a lot in anticipation!!!
chatguy2020.
|