Computing.Net > Forums > Unix > shell script that reads a file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

shell script that reads a file

Reply to Message Icon

Name: chatguy2020
Date: May 4, 2003 at 20:33:52 Pacific
OS: aix
CPU/Ram: --
Comment:

Hi all!!

I am totally new to shell scripting.

I need a 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)
secu_server-0@myqsnhere.com->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.



Sponsored Link
Ads by Google

Response Number 1
Name: LANkrypt0
Date: May 5, 2003 at 05:44:40 Pacific
Reply:

Where is this file stored?
I take it is always in the same directory?
Is it alone in that directory?
Is the file name always the same?

With that, it should be pretty easy to do. I think; *grin*


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: shell script that reads a file

Shell script to read a file and pro www.computing.net/answers/unix/shell-script-to-read-a-file-and-pro/4304.html

Script that sends a file via mailx www.computing.net/answers/unix/script-that-sends-a-file-via-mailx/6063.html

shell script to send a file thru FT www.computing.net/answers/unix/shell-script-to-send-a-file-thru-ft/6428.html